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

convertbmp: detect invalid file dimensions early (CVE-2018-6616) #1172

Merged
merged 1 commit into from
Dec 21, 2018

Conversation

hlef
Copy link
Contributor

@hlef hlef commented Dec 14, 2018

width/length dimensions read from bmp headers are not necessarily valid. For instance they may have been maliciously set to very large values with the intention to cause DoS (large memory allocation, stack overflow). In these cases we want to detect the invalid size as early as possible.

This PR introduces a counter which verifies that the number of written bytes corresponds to the advertised width/length.

If advertised size and actual size don't match, we return false which basically aborts execution.

We might alternatively consider resizing the data array and continue the execution normally. Do you think this would be preferable ?

This PR fixes #1059.

width/length dimensions read from bmp headers are not necessarily
valid. For instance they may have been maliciously set to very large
values with the intention to cause DoS (large memory allocation, stack
overflow). In these cases we want to detect the invalid size as early
as possible.

This commit introduces a counter which verifies that the number of
written bytes corresponds to the advertized width/length.

Fixes uclouvain#1059 (CVE-2018-6616).
@amontalban
Copy link

@rouault can you review this PR? It would help us a lot to have this fixed. Thanks!

@rouault rouault merged commit 51f097e into uclouvain:master Dec 21, 2018
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.

Excessive Iteration in opj_t1_encode_cblks (src/lib/openjp2/t1.c)
3 participants