google / wuffs

Wrangling Untrusted File Formats Safely
Other
4.06k stars 129 forks source link

lib/readerat: delayed invalid seek offset detected? #80

Closed detaoin closed 2 years ago

detaoin commented 2 years ago

Hi,

I was reading the code, out of curiosity, and it seems to me that the conditional test that checks whether the seek offset is negative misses this case (it will be detected by the next call to ReadAt).

https://github.com/google/wuffs/blob/b8d44be7835a373633e7cf0987978d4a5733fcf5/lib/readerat/readerat.go#L90

should be

if offset < 0 {

instead?

nigeltao commented 2 years ago

You're right. Thanks for the bug report.