lz1 icon indicating copy to clipboard operation
lz1 copied to clipboard

Bug in the source code

Open gogo9th opened this issue 6 years ago • 0 comments

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"

gogo9th avatar Jun 20 '19 01:06 gogo9th