brickadia / brs

Read and write Brickadia saves.
8 stars 2 forks source link

return err in read_compressed instead of panicking #9

Closed dgunay closed 3 years ago

dgunay commented 3 years ago

Attempting to address https://github.com/brickadia/brs/issues/4

At first I attempted to reconstruct a panicking input, but it was a lot of trouble so I just ended up returning the Err instead of unwrapping. The panic would only have happened if the actual uncompressed size does not match the indicated uncompressed size. I'm unfamiliar with zlib and brs so if it is more complicated than this please let me know.

qoh commented 3 years ago

There are several others, most due to EOF in BitReader. It'll be a slightly larger effort to safely handle it all, especially as I might be replacing the BitReader implementation, but that can't really start until the 0.3 changes are more done. This one still counts though, thanks.