lz1
lz1 copied to clipboard
Bug in the source code
Hi,
Thanks for your useful compression code. I found there is a bug in here. The line:
for(temp_pointer_length = 0; && uncompressed_text[look_ahead++] == uncompressed_text[look_behind++]; ++temp_pointer_length)
Should be changed to:
for(temp_pointer_length = 0; look_ahead < uncompressed_size && uncompressed_text[look_ahead++] == uncompressed_text[look_behind++]; ++temp_pointer_length)
Basically, we should check the array boundary: "look_ahead < uncompressed_size"