cr-marcstevens / hashclash

Project HashClash - MD5 & SHA-1 cryptanalysis
Other
742 stars 87 forks source link

textcoll fails to complete because of an assertion #41

Closed Kriskras99 closed 2 months ago

Kriskras99 commented 2 months ago

When running textcoll.sh with the default configuration I get the following error:

***Converting into look-up table.../usr/include/c++/14.1.1/bits/stl_vector.h:1130: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::array<unsigned int, 4>; _Alloc = std::allocator<std::array<unsigned int, 4> >; reference = std::array<unsigned int, 4>&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

It then creates a coredump (takes quite a long time!) and quits.

I've installed hashclash using the AUR package, so it links to Boost 1.83 instead of the older version specified in install_boost.sh.

cr-marcstevens commented 2 months ago

Thanks for the report. I just checked the code and indeed there is clearly an out of bounds bug. I'm surprised it never showed up before...

cr-marcstevens commented 2 months ago

I'm on my phone, so hard to fix a.t.m. If anyone wants to submit a PR to fix this line with a guard on j < size then I would be happy to merge it: https://github.com/cr-marcstevens/hashclash/blob/c8bc857c008ce9aea092ab8eb198e6411b0d2fd4/src/md5textcoll/block1.cpp#L348

angea commented 2 months ago

Submitted PR #42

cr-marcstevens commented 2 months ago

Thank Ange for the fix!