Skip to content
This repository has been archived by the owner on Jul 29, 2020. It is now read-only.

Lots of CVE fixes #38

Merged
merged 35 commits into from
Jun 29, 2020
Merged

Lots of CVE fixes #38

merged 35 commits into from
Jun 29, 2020

Conversation

MaxKellermann
Copy link
Contributor

No description provided.

@MaxKellermann
Copy link
Contributor Author

libFuzzer keeps finding new bugs. This is bad!
JasPer is a fractal of security vulnerabilities. The closer you look, the more you see.

When iterating over `dec->cdef->data.cdef.ents`, we need to use its
`numchans` variable, not the one in `jp2_dec_t`.

Fixes CVE-2018-19543
Fixes CVE-2017-9782

Closes #13
Closes #18
Closes jasper-software/jasper#140
Closes jasper-software/jasper#182
This replaces my commit 910c351 which
was reverted by fc03b57

Closes #10
PoC file is a MIF image with no components, which causes a NULL
pointer dereference or heap buffer overflow when reading informationa
about the first component.

Fixes CVE-2017-14132

Closes #17
According to the specification A.5.1 Table A-11, the component bit
depth can be at most 38.

Fixes CVE-2017-5499 (integer overflow)

Closes #2
Closes jasper-software/jasper#63
By using height==0, the width can exceed the configured max_samples
setting allows attackers to cause gigabytes of memory allocations.
Prevent yet another out-of-memory vulnerability.
…ni()

If jpc_dec_tileinit() fails, the `bands` variable is left
uninitialized, so jpc_dec_tilefini() attempts to free an arbitrary
pointer, crashing the application.
Make the buffer "unsigned" and cast each byte to an unsigned 32 bit
integer before shifting.  This fixes the following UBSan warnings:

 left shift of negative value X
 left shift of X by 24 places cannot be represented in type 'int'
@MaxKellermann MaxKellermann mentioned this pull request Jun 28, 2020
@MaxKellermann
Copy link
Contributor Author

This PR fixes all pending bug reports and CVEs (plus many more bugs found by libFuzzer in the past few days).

Cropping cannot work.  Either we need to ignore and skip all data, or
bail out.  But cropping the size and pretending everything is ok will
fail the next box.
jas_stream_copy() gets an `int` as size parameter, so large box sizes
will result in a negative value, which is (surprisingly) a legal
parameter value for jas_stream_copy().
@jubalh
Copy link
Member

jubalh commented Jun 29, 2020

Awesome work! @MaxKellermann do you plan to push more to this branch or can I review?

@MaxKellermann
Copy link
Contributor Author

Review & merge any time.
The fuzzer is still running and keeps finding new bugs, but I can create new PRs for new fixes after this one is merged.

@jubalh jubalh merged commit 69bba14 into jasper-maint:master Jun 29, 2020
@jubalh jubalh mentioned this pull request Jun 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants