aMule Forum

English => en_Bugs => Topic started by: mr_hyde on January 04, 2008, 01:06:10 AM

Title: 20080103: crash on start (while hashing part files)
Post by: mr_hyde on January 04, 2008, 01:06:10 AM
See http://bugs.amule.org/view.php?id=1232.

Sometimes amule crashes with following message:

/usr/lib64/gcc/x86_64-slamd64-linux/4.1.2/../../../../include/c++/4.1.2/debug/vector:192:
    error: attempt to subscript container with out-of-bounds index 0, but
    container only holds 0 elements.

Objects involved in the operation:
sequence "this" @ 0x0x45008c80 {
  type = N15__gnu_debug_def6vectorIhSaIhEEE;
}

The problem is in src/TreadTasks.cpp, method void CHashingTask::Entry(). Here you can read:

Code: [Select]
if ((m_toHash & EH_MD4) && !TestDestroy()) {
// If the file is < PARTSIZE, then the filehash is that one hash,
// otherwise, the filehash is the hash of the parthashes
if ( knownfile->m_hashlist.size() == 1 ) {
knownfile->m_abyFileHash = knownfile->m_hashlist[0];
knownfile->m_hashlist.clear();
} else {
const unsigned int len = knownfile->m_hashlist.size() * 16;
std::vector<byte> data(len);

for (size_t i = 0; i < knownfile->m_hashlist.size(); ++i) {
memcpy(&(data[16*i]), knownfile->m_hashlist[i].GetHash(), 16);
}

std::vector<byte> hash(16);
knownfile->CreateHashFromString( &(data[0]), len, &(hash[0]), NULL );
knownfile->m_abyFileHash.SetHash( (byte*)&(hash[0]) );
}

Sometimes (at least this happens to me) knownfile->m_hashlist IS EMPTY and this causes the crash.
I just patched the code to avoid the crash, but I don't consider this a real fix (I don't know enough the code).
The patch is in attach here and in bugs.amule.org.

By the way: I made mistakes while posting in bugs.amule.org. Is it possible to modify reports posted in bugs.amule.org?

Bye,
  Mr Hyde
Title: Re: 20080103: crash on start (while hashing part files)
Post by: wuischke on January 04, 2008, 09:13:49 AM
Yes, you can. Click on "Update Issue" in the bottom left corner of the bug report.
Title: Re: 20080103: crash on start (while hashing part files)
Post by: mr_hyde on January 04, 2008, 09:56:51 AM
Yes, you can. Click on "Update Issue" in the bottom left corner of the bug report.

Ehm, sorry, but even if I'm logged in, on the bottom left corner of bug report I see only one button ("Monitor Issue").
Probably I did not understand something?

Bye,
  Mr Hyde
Title: Re: 20080103: crash on start (while hashing part files)
Post by: wuischke on January 04, 2008, 10:07:28 AM
I have three elements there: Update Issue, Assign to: name, Change status to: status so it's probably only a part of the developer permissions.

We should ask Kry about it, I think a user should be able to modifiy his own bug report.
Title: Re: 20080103: crash on start (while hashing part files)
Post by: Xaignar on January 04, 2008, 03:12:02 PM
Nevermind the bug-tracker, I think I've figured out the cause of this problem (other than improper usage of std::vector). Thanks for pointing it out. Also found another bug thanks to that ...

EDIT: Yup, found it ...
Title: Re: 20080103: crash on start (while hashing part files)
Post by: Xaignar on January 06, 2008, 07:03:13 AM
Sorry for the slowness. This bug should now be fixed, as well as an related bug in the corruption checks for .part files.