Skip to content
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

Merged
merged 3 commits into from
Oct 11, 2017
Merged

Fix CVE-2017-14860 #108

merged 3 commits into from
Oct 11, 2017

Conversation

D4N
Copy link
Member

@D4N D4N commented Oct 5, 2017

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 do you have an idea?

This fixes #71.

@D4N D4N changed the title Fix cve 2017 14860 Fix CVE-2017-14860 Oct 5, 2017
@clanmills
Copy link
Collaborator

clanmills commented Oct 6, 2017 via email

@D4N
Copy link
Member Author

D4N commented Oct 6, 2017

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.

@clanmills
Copy link
Collaborator

Sounds good to me.

@clanmills
Copy link
Collaborator

@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'.

@D4N
Copy link
Member Author

D4N commented Oct 6, 2017

Sure, I'll do that. But I'd rather put that in a different PR.

@D4N D4N force-pushed the fix_CVE-2017-14860 branch from 2ca652e to 391ddcb Compare October 6, 2017 21:12
@D4N
Copy link
Member Author

D4N commented Oct 6, 2017

I have created a new error message and updated the PR.

@D4N
Copy link
Member Author

D4N commented Oct 6, 2017

The requested enumeration can be found in #109.

@D4N
Copy link
Member Author

D4N commented Oct 10, 2017

Can we merge this? I would like to first merge this patch, then #110 so that I can update the proposed error enumeration in #109.

@clanmills
Copy link
Collaborator

clanmills commented Oct 10, 2017 via email

Copy link
Collaborator

@clanmills clanmills left a 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.

D4N added 3 commits October 11, 2017 00:11
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.
@D4N D4N force-pushed the fix_CVE-2017-14860 branch from 391ddcb to c884a3b Compare October 10, 2017 22:12
@piponazo piponazo merged commit f06418c into Exiv2:master Oct 11, 2017
@D4N D4N deleted the fix_CVE-2017-14860 branch May 28, 2018 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It is a heap-buffer-overflow in Exiv2::Jp2Image::readMetadata (jp2image.cpp:277)
3 participants