mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
Most tests fail when kFileBufferSize is set to 3 in tools/buffer.c (or the API is used directly) #324
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @danielrh on GitHub (May 28, 2020).
I've encountered a situation where a particular personal file I have cannot be decompressed with a buffer of 8192
When I tried setting kFileBufferSize to small values like 1 2 or 3, all the tests start to fail
the offending piece of code seems to be the check for zero available_in on the context
https://github.com/google/brotli/tree/master/c/tools#L889
This is a patch to reproduce the issue
broken_buffer_size.txt
@eustas commented on GitHub (Jul 2, 2020):
Strange. Internally we have tests that feed input and output byte-by-byte.
Thanks for the report. Will investigate soon.
@eustas commented on GitHub (Jul 2, 2020):
Was able to reproduce.
@eustas commented on GitHub (Jul 2, 2020):
Currently what I see is that
feofis lying! It tells "no" at the end of file!And it happens only if file size is divisible by buffer size (in this case 3).
Will check if this is a known thing and how we could do with it (e.g. do extra read instead of
feof...)@jfkthame commented on GitHub (Jul 2, 2020):
On 02/07/2020 15:49, Eugene Kliuchnikov wrote:
This sounds like expected behavior; feof() will return true only if
there has been an attempt to read PAST the end of file. Simply reading
UP TO the end of the file does not set the EOF flag.
JK
@eustas commented on GitHub (Jul 2, 2020):
Well, it is underspecified, and counterintuitive. It is not said "it will", it is said "indicator is generally set..."
@eustas commented on GitHub (Jul 2, 2020):
@danielrh feel free to reopen the bug, if the problem is still there.
@jfkthame commented on GitHub (Jul 2, 2020):
Maybe that depends on the documentation you refer to... for example, https://en.cppreference.com/w/c/io/feof makes it clear that this is the expected behavior (although I agree it seems counterintuitive).
Anyhow, the fix looks like it should be fine.