The code below is crashing in MeterFilter::PutMaybeModifiable


Stack trace
1 CryptoPP::StreamTransformationFilter::FirstPut(unsigned const char *) 
filters.cpp 632 0x10008ca83 
2 CryptoPP::FilterWithBufferedInput::PutMaybeModifiable(unsigned char *, 
unsigned long, int, bool, bool) filters.cpp 370 0x10008b968 
3 CryptoPP::FilterWithBufferedInput::PutModifiable2(unsigned char *, 
unsigned long, int, bool) filters.h 344 0x1000131f2 
4 CryptoPP::Filter::OutputModifiable(int, unsigned char *, unsigned long, 
int, bool, std::string const&) filters.cpp 122 0x10008aee4 
5 CryptoPP::MeterFilter::PutMaybeModifiable(unsigned char *, unsigned long, 
int, bool, bool) filters.cpp 213 0x10008aec3 
6 CryptoPP::FileStore::TransferTo2(CryptoPP::BufferedTransformation&, 
unsigned long long&, std::string const&, bool) files.cpp 99 0x100087b99 
7 CryptoPP::SourceTemplate<CryptoPP::FileStore>::Pump2(unsigned long long&, 
bool) filters.h 1214 0x100013dbb 
8 CryptoPP::Source::Pump(unsigned long long) filters.h 1146 0x10000f4e4 
9 Hash::aesEncryptFilePump() hash.cpp 315 0x10000ecf0 

after calling

aesEncryptFileOpen(QString inFile, QString outFile);

aesEncryptFilePump() 

is called, to start it then the GUI keeps pumping. I don't know why the 
MeterFilter should _ever_ crash? readLength is 65536.


 

> void Hash::aesEncryptFileOpen(QString inFile, QString outFile) {
>
>       inFilename = inFile;
>
>       outFilename = outFile;
>
>
>       QString ivHex = hashFile(inFilename, false).mid(0,32);
>
>       QByteArray binIv = QByteArray::fromHex(ivHex.toUtf8());
>
>       char inFilename_[256];
>
>       char outFilename_[256];
>
>       memset(inFilename_, 0, sizeof(inFilename_));
>
>       memset(outFilename_, 0, sizeof(outFilename_));
>
>
>       strncpy(inFilename_, inFilename.toLocal8Bit().constData(), 
> inFilename.toLocal8Bit().length());
>
>       strncpy(outFilename_, outFilename.toLocal8Bit().constData(), 
> outFilename.toLocal8Bit().length());
>
>       _fileSource = new CryptoPP::FileSource(inFilename_, false);
>
>       _fileSink = new CryptoPP::FileSink(outFilename_);
>
>       _meterFilter= new CryptoPP::MeterFilter();
>
>       CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption e((const byte 
> *)_key.constData(), _key.length(), (const byte *)binIv.constData(), 1);
>
>       _stf = new CryptoPP::StreamTransformationFilter(e);
>
>
>       if (_base64Output)
>
>               _base64Encoder = new CryptoPP::Base64Encoder();
>
>       else
>
>               _base64Encoder = NULL;
>
>
>       _fileSource->Attach(_meterFilter);
>
>       _meterFilter->Attach(_stf);
>
>       if (_base64Encoder) {
>
>               _stf->Attach(_base64Encoder);
>
>               _base64Encoder->Attach(_fileSink);
>
>       } else {
>
>               _stf->Attach(_fileSink);
>
>       }
>
>       QFileInfo fi (inFilename);
>
>       totalBytesToEncrypt = fi.size();
>
>       bytesEncrypted = 0;
>
>
> }
>
>
> void Hash::aesEncryptFilePump() {
>
>       qlonglong readLength = qMin(_blockSize, totalBytesToEncrypt - 
> bytesEncrypted);
>
>       bytesEncrypted += readLength - _fileSource->Pump(readLength);
>
>       if (_fileSource->SourceExhausted())
>
>       {
>
>               aesEncryptFileClose();
>
>               emit aesEncryptFileComplete(inFilename);
>
>       }
>
> }
>
>
>

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to