nwaples / rardecode

A go package for reading RAR archives.
BSD 2-Clause "Simplified" License
124 stars 28 forks source link

Error in ppm_model #5

Closed rhaist closed 9 years ago

rhaist commented 9 years ago

On some really corrupt rar files I get an "integer divide by zero" error in decodeSymbol1() probably caused in the call to currentCount()

You maybe want to include a check to ensure scale and r.rnge are not null and throw an errCorruptPPM otherwise.

https://github.com/nwaples/rardecode/blob/master/ppm_model.go#L321

nwaples commented 9 years ago

I probably should, but I wonder if its a problem with my logic somewhere else. I can't see any similar checks in the unrar source. The ppm stuff in unrar was the least understandable for me.

I have tried to reproduce the problem with corrupt files, but no luck so far. I added a couple more checks in, but if that doesn't fix it, ill add that check in.

rhaist commented 9 years ago

Problem has been taken care of in the latest commits.