-
-
Notifications
You must be signed in to change notification settings - Fork 308
Fix an issue with regard to finishing out the window #1602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1602 +/- ##
============================================
+ Coverage 69.90% 83.27% +13.37%
============================================
Files 116 133 +17
Lines 9479 10880 +1401
Branches 2341 2809 +468
============================================
+ Hits 6626 9060 +2434
+ Misses 1777 1117 -660
+ Partials 1076 703 -373
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
ec455c0 to
956c74d
Compare
|
OK, I think this will work. It's maybe a bit hackier than I'd like but I'm pretty sure correctness isn't an issue. This should catch the corner case we were seeing. The main difference is I think there were unconditional checksums being applied in earlier versions in a lot of places. I don't see a clean delineation where we clearly aren't applying the checksum but should be, though. |
956c74d to
399ea73
Compare
|
Hmm, I have half a mind to write the buffer being fed through that library's test suite and put it into ours. |
|
Not sure what's up with the clang reduced memory failure. Ahh, it does look like it reduces the window size to 8k, so perhaps this is making us hit a different corner case. It also has dawned on me that the checksum will always be the initial CRC32 value until the final fold so that bit might need to be reworked. |
|
I reproduced the reduced mem failure, I'll look into it tonight. |
399ea73 to
46a381e
Compare
|
Ok I think I got it. Still a little hackier than I'd like (I'd be much more thrilled about catching the set of conditions that paints us in this corner) but barring better suggestions or proof that this is not catching all of the corner cases, I say it's ready to merge. |
400285a to
ee8207c
Compare
ee8207c to
4ee001c
Compare
Dead2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Wish we did have a CI test for this, so we could make sure that this is not a problem for all the other alternative code-paths as well. I don't think any other arch based their code on |
|
The problem isn't specific to crcs, it's specific to inflate. There's a potential encoding through the compression state machine that arrives at the final check instruction without the current window getting run through the checksum routines. This seems to catch those corner cases, as when it happens the checksum is the initial unaltered checksum, be that Adler or crc. As far as something that catches this, I think integrating libgit2's tests into our CI wouldn't be a bad approach. |
mtl1979
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM... We can add CI test in separate pull request.
|
I am testing using
Here is my test data: minideflate -d -k -s 4 -r 25 -w 15 -t 8192 000000A2CD78EBA0-inflate.gzAnd change err = PREFIX(inflate)(&d_stream, flush);
if (err == Z_BUF_ERROR && read_buf_size != BUFSIZE) {
err = Z_OK;
}So essentially, it only works because in |
4ee001c to
092d97c
Compare
092d97c to
d7b44f1
Compare
|
Yes, I can create a PR with my |
mtl1979
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs further testing...
23ecfbd to
d05324d
Compare
d05324d to
c917629
Compare
17494ae to
c6e8c11
Compare
|
LGTM, now we just need to rebase after #1603 is merged. |
|
Rebase please 👍 |
Dead2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this elegant solution 👍
c6e8c11 to
06e1c9e
Compare
|
Guessing we can probably ignore that failure to upload issue? |
if inflate is invoked with Z_FINISH, and it deems a window was not necessary, there's a corner case where we never checksum the bytes. Detect this by checking the window size against zero and the value of the flush parameter. This should fix issue zlib-ng#1600, and possibly zlib-ng#1565 as well.
06e1c9e to
b0607c3
Compare
|
Rerolling the dice anyway for that green check mark. |
|
Looking good, all tests passing. I will probably roll out a hotfix release with this within a day or two, unless something crops up. |
mtl1979
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Evidently we weren't hitting this code path very often in our tests?
If we reach here, there are some circumstances where we never ran any
of the bytes through the checksum. We can easily check for this with a
comparison if the initial checksum bytes.
This should fix issue #1600, and possibly #1565 as well.