-
Notifications
You must be signed in to change notification settings - Fork 287
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
Fix CVE-2017-14860 #108
Fix CVE-2017-14860 #108
Conversation
The errors you can throw are in src/error.cpp. If you feel it’s important, you can add a new error. I try to keep the errors “generic” to be used in different places. However you are welcome to add errors if you think this is required.
Robin
… On 5 Oct 2017, at 19:35, D4N ***@***.***> wrote:
A heap buffer overflow could occur in memcpy when icc.size_ is larger than data.size_ - pad, as then memcpy would read out of bounds of data.
This PR adds a sanity check to iccLength (= icc.size_): if it is larger than data.size_ - pad (i.e. an overflow would be caused) an exception is thrown. However it currently throws Error 57 which is invalid memory allocation request and imho rather inappropriate. Unfortunately I don't know which error would be better suited or if a new one should be created. @clanmills <https://github.com/clanmills> do you have an idea?
This fixes #71 <#71>.
You can view, comment on, or merge this pull request online at:
#108 <#108>
Commit Summary
Fix for CVE-2017-14860
Added the reproducer for CVE-2017-14860 to the test suite
File Changes
M src/jp2image.cpp <https://github.com/Exiv2/exiv2/pull/108/files#diff-0> (9)
M test/bugfixes-test.sh <https://github.com/Exiv2/exiv2/pull/108/files#diff-1> (7)
A test/data/003-heap-buffer-over <https://github.com/Exiv2/exiv2/pull/108/files#diff-2> (0)
M test/data/bugfixes-test.out <https://github.com/Exiv2/exiv2/pull/108/files#diff-3> (0)
Patch Links:
https://github.com/Exiv2/exiv2/pull/108.patch <https://github.com/Exiv2/exiv2/pull/108.patch>
https://github.com/Exiv2/exiv2/pull/108.diff <https://github.com/Exiv2/exiv2/pull/108.diff>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#108>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAgWPpQJ_G14TW5hzcryU-apAipAugknks5spWe-gaJpZM4Pv1r6>.
|
Ok, please don't merge this yet then. I knew where the errors were, I just didn't find one that I found appropriate. How about a very generic error "Corrupted image meta-data"? To the end user this is pretty clear and a developer will probably have a debugger ready and will find out where it occurred. |
Sounds good to me. |
@D4N Could you consider adding an enum for the errors in error.hpp? It's easier to grep a throw in the code with a symbolic name such as Exiv2::kerImageParsingError than '58'. |
Sure, I'll do that. But I'd rather put that in a different PR. |
2ca652e
to
391ddcb
Compare
I have created a new error message and updated the PR. |
The requested enumeration can be found in #109. |
I think this is OK. I’m in McDonalds and the internet connection to GitHub isn’t good. I’ve been able to approve #109 (the ErrorCodes). Can’t get through to #108 and #110. I’tl try from our hotel this evening.
Robin
… On 10 Oct 2017, at 16:18, D4N ***@***.***> wrote:
Can we merge this? I would like to first merged this patch, then #110 <#110> so that I can update the proposed error enumeration in #109 <#109>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#108 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAgWPjQE0j6Tn5r2g1NdVpZp55GIyNzEks5sq9EFgaJpZM4Pv1r6>.
|
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.
Looks good, thanks very much.
A heap buffer overflow could occur in memcpy when icc.size_ is larger than data.size_ - pad, as then memcpy would read out of bounds of data. This commit adds a sanity check to iccLength (= icc.size_): if it is larger than data.size_ - pad (i.e. an overflow would be caused) an exception is thrown. This fixes Exiv2#71.
391ddcb
to
c884a3b
Compare
A heap buffer overflow could occur in
memcpy
whenicc.size_
is larger thandata.size_ - pad
, as thenmemcpy
would read out of bounds ofdata
.This PR adds a sanity check to
iccLength
(=icc.size_
): if it is larger thandata.size_ - pad
(i.e. an overflow would be caused) an exception is thrown. However it currently throws Error 57 which isinvalid memory allocation request
and imho rather inappropriate. Unfortunately I don't know which error would be better suited or if a new one should be created. @clanmills do you have an idea?This fixes #71.