You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the various number reader methods defined in
std::rt::io::extensions::ReaderByteConversions
are based on read_u8_ and read_i8_ which simply return 0 if the byte could not be read. This means that the user can silently read bad values, e.g.
$ rusti
rusti> use std::rt::io::Reader;
rusti> use std::rt::io::extensions::ReaderUtil;
rusti> use std::rt::io::extensions::ReaderByteConversions;
rusti> use std::rt::io::mem::MemReader;
rusti> MemReader::new(~[1]).read_be_u32_()
16777216
I suggest that a read_u8_ and read_i8_ should raise an EndOfFile, similarly to ReaderUtil::push_bytes, so the user can handle that case.