Skip to content

Security: bump go-images/jpeg2000 to v0.13.8 — a crafted PDF could crash Page - #120

Merged
tannevaled merged 1 commit into
mainfrom
jpeg2000-v0.13.8
Oct 20, 2026
Merged

tannevaled merged 1 commit into
mainfrom
jpeg2000-v0.13.8

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

A PDF could crash the program drawing it

Up to jpeg2000 v0.13.7, fourteen bytes of JPEG 2000 made jpeg2000.DecodeConfig divide by zero: SOC, then SOT with no SIZ. This package calls DecodeConfig to size every JPXDecode image (image.go:889, decodeJPX). Nothing here recovers, so any PDF carrying such an image takes down the program that renders it.

Witnessed, not inferred: the new test TestACodestreamThatCrashedTheDecoderDoesNotCrashThePage panics at v0.13.7:

panic: runtime error: integer divide by zero
jpeg2000.parseCodestream  jpeg2000@v0.13.7/codestream.go:502
jpeg2000.DecodeConfig     jpeg2000@v0.13.7/decoder.go:51
render.init.func3         image.go:889
render.(*renderer).decodeJPX   image.go:723
...
render.Page               render.go:110

It passes at v0.13.8. That release validates the headers as OpenJPEG does (go-images/jpeg2000#36). jpeg2000's new FuzzDecode found this panic and two more; all three are fixed.

The test stays as a regression test. All tests pass.

🤖 Generated with Claude Code

Up to jpeg2000 v0.13.7, fourteen bytes of JPEG 2000 -- SOC, then SOT with no
SIZ -- divided by zero inside jpeg2000.DecodeConfig. This package calls it
to size every JPXDecode image (image.go:889, decodeJPX), and nothing here
recovers, so any PDF carrying such an image took down the program that
drew it. Witnessed, not inferred: the new test panics at v0.13.7 through
Page -> drawImageXObject -> decodeJPX -> DecodeConfig, and passes at
v0.13.8, which validates the headers as OpenJPEG does
(go-images/jpeg2000#36; found by its FuzzDecode, with two more panics).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit d128cba into main Oct 20, 2026
13 checks passed
@tannevaled
tannevaled deleted the jpeg2000-v0.13.8 branch October 20, 2026 12:53
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.

1 participant