Debian Patches

Status for cairo/1.18.6-1

Patch Description Author Forwarded Bugs Origin Last update
image-info-Fix-out-of-bounds-read-and-uninitialized-info-.patch image-info: Fix out-of-bounds read and uninitialized info for JPEG
At a start of frame marker, _cairo_image_info_get_jpeg_info() checks
that p[0] to p[7] are within the data, where p points to the second
byte of the marker, but _jpeg_extract_info() also reads p[8], the
number of components. Check that p[8] is within the data.

If the data ends without a start of frame segment, the function
returned success without setting any field of info. The PDF, PS, SVG
and win32 printing surfaces then used the uninitialized width, height
and number of components. Return CAIRO_INT_STATUS_UNSUPPORTED instead,
so that the image is embedded as if it had no JPEG mime data.

Also make _jpeg_skip_segment() return the end of the data instead of a
pointer beyond it when the segment length is larger than the remaining
data.

(cherry picked from commit dd4da532e5a25935b08f5324a44b35246aa743e8)
Ana Bobillo <anabobillo3@gmail.com> no upstream, after 1.18.6 2026-10-23
image-info-Fix-infinite-loop-on-JPEG-2000-boxes-with-leng.patch image-info: Fix infinite loop on JPEG 2000 boxes with length 0
_jpx_next_box() returns p + length. A box with a length of 0 thus
returned the same box again, and _jpx_find_box() looped forever when
the data contained such a box before the JP2 header box. Box lengths 1
to 7 were also used as they are, although 1 means that a 64-bit length
follows the box type and 2 to 7 are reserved.

Add _jpx_box_length() and use it in both _jpx_next_box() and
_jpx_match_box(). A length of 0 means that the box extends to the end
of the data, as the JPEG 2000 file format specifies. Boxes with a
64-bit length or a reserved length are not supported. The length is
compared with the remaining data instead of computing a pointer that
may lie beyond the end of the data.

_jpx_match_box() now also accepts a box that ends exactly at the end
of the data, which it rejected before.

(cherry picked from commit 89f049a35e4a1aeef65f48470bf0a09a715fc0df)
Ana Bobillo <anabobillo3@gmail.com> no upstream, after 1.18.6 2026-10-23
image-info-Fix-out-of-bounds-reads-for-JBIG2.patch image-info: Fix out-of-bounds reads for JBIG2
_jbig2_find_data_end() looks for the two byte end sequence while
p < end, which reads p[1] one byte past the end of the data when the
last byte matches the first byte of the end sequence. Loop while
p + 1 < end.

_jbig2_get_next_segment() added the size of the referred-to segment
numbers and the segment data length, both read from the data, to the
pointer before comparing it with the end of the data. With large
values the pointer may wrap around on 32-bit systems and pass the
check. Compare the lengths with the remaining data instead.

(cherry picked from commit 1e5851bdc9d5a4fdc43167e24774615dd143068f)
Ana Bobillo <anabobillo3@gmail.com> no upstream, after 1.18.6 2026-10-23
test-Add-pdf-mime-data-invalid.patch test: Add pdf-mime-data-invalid
Check that JPEG, JPEG 2000 and JBIG2 mime data with an invalid header
is not embedded by the PDF surface. Run under AddressSanitizer, it also
checks that reading the header stays within the data.

(cherry picked from commit ac398637724bb31b991e50e0662b2b2dc36f14e9)
Ana Bobillo <anabobillo3@gmail.com> no upstream, after 1.18.6 2026-10-23

All known versions for source package 'cairo'

Links