-
Notifications
You must be signed in to change notification settings - Fork 182
Closed
Labels
Description
Hi all
I have a weird decompression bug with deflate. I isolated it to this buffer:
let hex_buffer = [0xaa, 0x56, 0x72, 0x4b, 0x2d, 0x49, 0xce, 0xf0, 0xc8, 0xcf, 0xcf, 0xf6, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, 0x49, 0x54, 0xb2, 0xaa, 0x56, 0xca, 0xc8, 0xcf, 0xcf, 0x56, 0xb2, 0x02, 0x53, 0xc5, 0xfa, 0x19, 0xa9, 0x39, 0x39, 0xf9, 0x4a, 0x3a, 0x4a, 0xd9, 0xa9, 0x95, 0x4a, 0x56, 0x4a, 0x89, 0x79, 0x95, 0x19, 0xf9, 0xe5, 0x4a, 0x00, 0x00, 0xff, 0xff];
let mut decoder = read::DeflateDecoder::new(&*hex_buffer);
let mut buf = Vec::new();
let decoded_len = decoder
.read_to_end(&mut buf)
.context("unable to read compressed payload")?;
let s = String::from_utf8(buf).context("utf-8 error")?;
let expected = "{\"FetchHookMetadata\":{\"hook\":\"hooks/hello\",\"key\":\"anyhow\"}}";This should return this String, but it is missing the last two }}
Since this buffer will be coming over WebSocket I extended it with [ 0x00, 0x00, 0xff, 0xff ] but not doing that made no difference.
Hope anyone has an idea on why it just does not decompress the last two Bytes.
Thank you in advance,
Stefan