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
Add bounds check on allocation size #846
Add bounds check on allocation size #846
Conversation
Codecov Report
@@ Coverage Diff @@
## 0.27-maintenance #846 +/- ##
====================================================
+ Coverage 62.71% 62.71% +<.01%
====================================================
Files 156 156
Lines 21558 21567 +9
====================================================
+ Hits 13520 13526 +6
- Misses 8038 8041 +3
Continue to review full report at Codecov.
|
src/pngchunk_int.cpp
Outdated
|
||
long length = (long) atol(startOfLength); | ||
enforce(length >= 0, Exiv2::kerCorruptedMetadata); |
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.
Could we merge these 2 conditions into a single call to enforce
? I am fine if you prefer to leave it as it is.
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.
done
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! Thanks!
683407d
to
bcaca80
Compare
Fixes #845.
The main issue is the unchecked value of
length
at pngchunk_int.cpp:669. But I have also fixed some minor issues where*sp
was read before the check thatsp < eot
.