| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Tiny style nit: can you put last clause on a separate line?
Sorry, something went wrong.
|
Would it be possible to shrink the test fixtures? We distribute the test suite and they add another 128 kB. |
Sorry, something went wrong.
There was a problem hiding this comment.
If you're using path.join here it should be path.join(common.fixturesDir, 'pseudo-multimember-gzip'); rather than concat the strings.
Sorry, something went wrong.
There was a problem hiding this comment.
… silly me 😄
Sorry, something went wrong.
|
Updated with your suggestions. I’ll see what I can do about the file sizes – it’s just not that easy to get specific bytes at specific positions in gzipped files. 😄 |
Sorry, something went wrong.
|
Okay, was easier than I thought, both files are now just a few hundred bytes together. |
Sorry, something went wrong.
|
Nice, thanks. LGTM. CI: https://ci.nodejs.org/job/node-test-pull-request/2040/ |
Sorry, something went wrong.
There was a problem hiding this comment.
deepStrictEqual might be better?
Sorry, something went wrong.
There was a problem hiding this comment.
Sure, why not. Updated using assert.deepStrictEqual.
Sorry, something went wrong.
|
LGTM minus a nit, CI failure is unrelated. |
Sorry, something went wrong.
Add test files that reliably reproduce nodejs#5852. The gzipped file in test/fixtures/pseudo-multimember-gzip.gz contains the gzip magic bytes exactly at the position that node encounters after having read a single block, leading it to believe that a new data member is starting.
Only treat the gzip magic bytes, when encountered within the file after reading a single block, as the start of a new member when the previous member has ended. Fixes: nodejs#5852
|
LGTM |
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
|
Wow, that was obvious in retrospect. Thanks! |
Sorry, something went wrong.
Only treat the gzip magic bytes, when encountered within the file after reading a single block, as the start of a new member when the previous member has ended. Add test files that reliably reproduce #5852. The gzipped file in test/fixtures/pseudo-multimember-gzip.gz contains the gzip magic bytes exactly at the position that node encounters after having read a single block, leading it to believe that a new data member is starting. Fixes: #5852 PR-URL: #5863 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
|
@addaleax the other edge-case you mentioned, do you mean that another member is starting but less that 10 bytes remain in the input buffer? I think you're right that this might occur (although pretty unlikely). We only actually need to check if there are two bytes remaining, enough for the magic byte comparison. Then again even with that change, the edge-case still exists, albeit even less likely. If f.x. only one byte remains in the input buffer, in which case the output would be truncated anyway. |
Sorry, something went wrong.
|
@kthelgason Yes, that’s what I’m talking about. I’ll try and see whether I can get a test case for that together, but I agree, it’s definitely not very likely to occur in the wild. |
Sorry, something went wrong.
Only treat the gzip magic bytes, when encountered within the file after reading a single block, as the start of a new member when the previous member has ended. Add test files that reliably reproduce #5852. The gzipped file in test/fixtures/pseudo-multimember-gzip.gz contains the gzip magic bytes exactly at the position that node encounters after having read a single block, leading it to believe that a new data member is starting. Fixes: #5852 PR-URL: #5863 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
| Back | FazBrowse Home | New Git URL |
Pull Request check-list
this change (including linting)?
test (or a benchmark) included?
Affected core subsystem(s)
zlib
Description of change
Fixes #5852, which was introduced in f380db2 (#5120).
Only treat the gzip magic bytes, when encountered within the file after reading a single block, as the start of a new member when the previous member has ended.
I’m really not sure on whether “pseudo-multimember-gzip” & co. are the right names for the test files, but I don’t think there’s a specific term for this very situation. 😄
I’m also not sure whether the ctx->strm_.avail_in >= GZIP_MIN_HEADER_SIZE check in node_zlib.cc doesn’t open the possibility of another edge case, namely that there is a new gzip member starting, but not enough bytes have been read into the internal buffer. But that is very likely not related to #5852, since I assume it would result in truncated output rather than an error.