Skip to content

jp3d/jpwl convert: fix write stack buffer overflow#1160

Merged
rouault merged 2 commits intouclouvain:masterfrom
hlef:master
Nov 16, 2018
Merged

jp3d/jpwl convert: fix write stack buffer overflow#1160
rouault merged 2 commits intouclouvain:masterfrom
hlef:master

Conversation

@hlef
Copy link
Copy Markdown
Contributor

@hlef hlef commented Oct 22, 2018

Missing buffer length formatter in fscanf call might lead to write stack buffer overflow.

(same patch as e528531)

Fixes #1044 (CVE-2017-17480).

Missing buffer length formatter in fscanf call might lead to write
stack buffer overflow.

fixes uclouvain#1044 (CVE-2017-17480)
Tile components in a JP2 image might have null data pointer by defining a
zero component size (for example using large horizontal or vertical
sampling periods). This null data pointer leads to null image component
data pointer, causing crash when dereferenced without != null check in
imagetopnm.

Add != null check.

This commit addresses uclouvain#1152 (CVE-2018-18088).
@hlef
Copy link
Copy Markdown
Contributor Author

hlef commented Nov 15, 2018

FTR, I have added a second fix addressing #1152. A few comments:

  • The first loop does not seem to be affected (line 2101), there are a few checks earlier during decoding forbidding the first tile to have zero size (not sure this is the expected behavior, but anyways). We might want to add a check there as well to be defensive, but it is not necessary to fix this issue.

  • There might be other places in the code affected by this issue, but this patch does not address them.

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.

2 participants