The GitHub Actions job "CodeQL" on 
commons-imaging.git/IMAGING-333-getImageInfo-no-sof has failed.
Run started by GitHub user akashchamp (triggered by akashchamp).

Head commit for run:
5a66d151dd5c1dd99865ed4a218ba1d4bd4d0c57 / Akash Kumar 
<[email protected]>
[IMAGING-333] Fix IndexOutOfBoundsException in JpegImageParser.getImageInfo()

readSegments() never returns null; when a JPEG has no SOF (Start Of
Frame) segment it returns an empty list instead. getImageInfo() only
checked SOF_segments == null before calling SOF_segments.get(0), so
the empty-list case threw an unchecked IndexOutOfBoundsException
rather than the intended ImagingException.

getImageSize(), a few lines below, already guards against this with
`abstractSegments == null || abstractSegments.isEmpty()`. Apply the
same guard to getImageInfo().

Add JpegWithoutSofSegmentTest, mirroring the existing
JpegWithInvalidDhtSegmentTest, asserting that a minimal JPEG with no
SOF segment causes Imaging.getImageInfo() to throw ImagingException.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

Report URL: https://github.com/apache/commons-imaging/actions/runs/36167329967

With regards,
GitHub Actions via GitBox

Reply via email to