MD5
MD5 copied to clipboard
Buffer-handling bug
I've just spent two days wondering why I couldn't get all the values generated by the library to match md5sum. I believe I've narrowed the problem down to a bug. Please see the attached image.
Sorry if this report comes across as terse or abrupt - I'm working like a dog trying to make a deadline right now :-)
Can you supply some values and the steps that you used to confirm this? I've looked at it quickly and it all appears to make sense...
I'm not sure I can explain the problem any more. Looking at the above again, it seems like a small write will either complete a block at the head of the function (in which case the tail section will stash what's left in the buffer), or it won't, causing the head and mid sections to skip and the new write to concatenate into the buffer. The only way to hit the zero assignment is for the input data to run out, in which case it must have been consumed by the head and mid sections. This must be my mistake - sorry for the false alarm.