When leaving this method, it tries to delete some objects (probably crypto++ guarded pointers) and then it crashes. I even tried to copy the objects to avoid any Qt guarded pointers trying to delete the same object nothing got better. Here it is:

void SharingSecret::secretRecoverFile(int threshold, QString outFilename, std::vector<QString>* inFilenames) {
    assert(threshold<=1000);
    if (threshold > 1000) {
        // throw some exception
    }
   
    char* outFile = new char[outFilename.length() + 1];
    std::strcpy(outFile, outFilename.ascii());

    CryptoPP::SecretRecovery recovery(threshold, new CryptoPP::FileSink(outFile));

    CryptoPP::vector_member_ptrs<CryptoPP::FileSource> fileSources(threshold);
    CryptoPP::SecByteBlock channel(4);
    int i;
    for (i = 0; i < threshold; i++) {
        QString inFilename = inFilenames->at(i);
        std::cout << "inFilename: " << inFilename << std::endl;
        char* filename = new char[inFilename.length() + 1];
        std::strcpy(filename, inFilename.ascii());
        fileSources[i].reset(new CryptoPP::FileSource(filename, false));
        fileSources[i]->Pump(4);
        fileSources[i]->Get(channel, 4);
        fileSources[i]->Attach(new CryptoPP::ChannelSwitch(recovery, string((char *)channel.begin(), 4)));
    }

    while (fileSources[0]->Pump(256)) {
        for (i=1; i<threshold; i++) {
            fileSources[i]->Pump(256);
        }   
    }

    for (i=0; i<threshold; i++) {
        fileSources[i]->PumpAll();
    }
}


Jens Peter Secher escreveu:
On 11/28/05, Douglas de Oliveira Mendes <[EMAIL PROTECTED]> wrote:
  
    Hi. I'm using debian an updated sometime ago the crypto++ lib. I got
now the secret sharing crashing.
    

Can you post some code that provokes the crash?
--
                                                    Jens Peter Secher
_DD6A 05B0 174E BFB2 D4D9 B52E 0EE5 978A FE63 E8A1 jpsecher gmail com_


  

Reply via email to