Commit graph

17 commits

Author SHA1 Message Date
Uli Schlachter
8dbc5893f7 Merge branch 'jpx-out-of-bounds' into 'master'
Fix possible out-of-bound reads in get_jpx_info

See merge request cairo/cairo!387
2023-01-02 09:28:42 +00:00
Uli Schlachter
e60e562fd1 Fix possible out-of-bound reads in get_jpx_info
Inspired by [1], I looked into the other functions in
cairo-image-info.c. This commit fixes the possible out-of-bound reads
that I found just by staring at the code.

_jpx_next_box() would happily read beyond the end of the data via
get_unaligned_be32(). This commit adds checks that at least for bytes of
data are available.

Additionally, I made this function check that its returned pointer is
within bounds, just because I found this easier to reason about.

Also, _jpx_extract_info() did not check that it had enough data to read.
This is fixed by making the function fallible and giving it information
about the end of data.

[1]: https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/386

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-01-01 14:01:46 +01:00
Uli Schlachter
d623090b32 Fix an out of bounds read in _jbig2_get_next_segment()
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38451
Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-01-01 09:43:33 +01:00
Anton Danilkin
170fa0f9bb Fix using signed types where unsigned ones were needed 2021-04-11 23:59:47 +02:00
Bryce Harrington
bf597b8928 Revert "Correctly decode Adobe CMYK JPEGs in PDF export"
From further testing and investigation it appears that many PDF viewers
already have a workaround to invert Adobe CMYK JPEGs, so our generated
PDFs display incorrectly with those viewers due to double-inversion.

Further investigation will be needed to find a better solution that
doesn't cause regression for some PDF viewers; perhaps PDF viewers that
lack this inversion workaround should be changed to include it.  For now
we'll drop the patch to avoid shipping the regression in 1.16.0.

This reverts commit b207a932a2.

Reference: https://bugs.freedesktop.org/show_bug.cgi?id=97612
Fixes: https://gitlab.freedesktop.org/cairo/cairo/issues/156
2018-10-16 09:53:00 -07:00
Adrian Johnson
57b40507dd Fix off by one check in cairo-image-info.c
https://bugs.freedesktop.org/show_bug.cgi?id=101427
2017-06-15 20:53:29 +09:30
Peter TB Brett
b207a932a2 Correctly decode Adobe CMYK JPEGs in PDF export
Adobe PhotoShop generates CMYK JPEG files with inverted CMYK.  When a
JPEG file with this format is included in a PDF file, a `/Decode`
array must be included to convert to "normal" CMYK.

These JPEG files can be detected via the presence of the APP14 "Adobe"
marker.  However, PDF viewers are not required to detect and handle
this private marker, so it must be detected and handled (by adding a
`/Decode`) by the PDF generator.

Signed-Off-By: Peter TB Brett <peter.brett@livecode.com>
2016-09-09 22:35:55 +09:30
Adrian Johnson
99a35dd273 CFF: Fix unaligned access
Debian bug 712836 reported bus errors in cff subsetting when
running on a sparc. This is because unlike truetype, all data
in the compact font format is not aligned.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712836
2014-10-19 11:54:25 +10:30
Adrian Johnson
5c0caa6f82 pdf: support JBIG2 mime data
JBIG2 images may have shared global data that is stored in a separate
stream in PDF. The CAIRO_MIME_TYPE_JBIG2 mime type is for the JBIG2
data for each image. All images that use global data must also set
CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID to a unique identifier. One of the
images must also set CAIRO_MIME_TYPE_JBIG2_GLOBAL to the global
data. The global data will be shared by all JBIG2 images with the same
CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID.
2013-09-15 20:50:46 +09:30
Chris Wilson
b132fae5e8 clip: Rudimentary support for clip-polygon extraction
Step 1, fix the failings sighted recently by tracking clip-boxes as an
explicit property of the clipping and of composition.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19 21:14:34 +01:00
Chris Wilson
9b9952ab4f Convert mime data length to use unsigned long
What we want to use is size_t, but we don't want the implied POSIX
dependency. However, POSIX does say that size_t is an unsigned integer
that is no longer than a long, so it would appear safe to use an
unsigned long as a replacement. Safer at least than unsigned int.
2010-07-10 11:16:19 +01:00
Andrea Canciani
b8a7f8621a Update FSF address
I updated the Free Software Foundation address using the following script.

for i in $(git grep Temple | cut -d: -f1 )
do
  sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i"
done

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
2010-04-27 11:13:38 +02:00
Adrian Johnson
8fa3cd9564 Change uint to uint32_t 2008-11-26 06:40:47 +10:30
Adrian Johnson
70e4c53272 Document location of image format specifications 2008-11-24 22:38:30 +10:30
Adrian Johnson
f59a3e03fc Add PNG get info function 2008-11-24 22:27:09 +10:30
Adrian Johnson
0746efbf07 Add JPEG2000 mimetype and image info function 2008-11-23 21:05:36 +10:30
Adrian Johnson
5de1e4de93 Move cairo-jpeg-info.c to cairo-image-info.c
Other image formats will be added to the same file.
2008-11-23 18:33:58 +10:30
Renamed from src/cairo-jpeg-info.c (Browse further)