capnproto-rust
capnproto-rust copied to clipboard
Reader fails with out of bounds pointer error when reading from compressed stream
Hello,
I have been using this library for a project and ran into a potential issue, and I am unsure if this is a problem with the library or with my code. Originally, I had code along the lines of this:
let mut gzreader = flate2::read::GzDecoder::new(gz_file);
let message_reader = serialize::read_message(
&mut BufReader::new(gzreader),
capnp_reader_options,
).unwrap();
let root_message = message_reader.get_root::<my_schema_capnp::message_type::Reader>().unwrap();
And it would always fail with MessageContainsOutOfBoundsPointer. However, when I replaced &mut BufReader::new(gzreader) with &uncompressed_data[..], where uncompressed_data was simply the fully uncompresed data, it would work. This solution works but is not ideal considering that my uncompressed data can be gigabytes in size.
Can you provide a self-contained example that reproduces the problem?