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
The read_gz_header_part function returns an Err if the first 10 bytes of the gzip header are not present or if the FEXTRA flag is set and the extra fields are not present. Returning an Err causes GzDecoder::write to keep the buffer and wait for more data to complete the header.
However, if the header contains an optional filename or comment but they are not completely contained in the buffer, then a valid header is created, missing data from the optional sections. The next write call will treat the remaining header as encoded data and attempt to unzip it.
The problem occurs because for byte in r.bytes() ends the iteration when the end of the buffer is found, falling through to the next state.
If this happens, the code should return Err(io::ErrorKind::UnexpectedEof) to allow a subsequent write to complete the header.
The text was updated successfully, but these errors were encountered:
The
read_gz_header_part
function returns anErr
if the first 10 bytes of the gzip header are not present or if the FEXTRA flag is set and the extra fields are not present. Returning anErr
causesGzDecoder::write
to keep the buffer and wait for more data to complete the header.However, if the header contains an optional filename or comment but they are not completely contained in the buffer, then a valid header is created, missing data from the optional sections. The next
write
call will treat the remaining header as encoded data and attempt to unzip it.The problem occurs because
for byte in r.bytes()
ends the iteration when the end of the buffer is found, falling through to the next state.If this happens, the code should return
Err(io::ErrorKind::UnexpectedEof)
to allow a subsequentwrite
to complete the header.The text was updated successfully, but these errors were encountered: