Fix loading of large JPEG files

This commit is contained in:
Bastien Nocera 2022-09-28 16:51:45 +02:00
parent c01095d8c1
commit 64f893b694
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 17a924a2275b3e7721dc05e0670cae638371a98f Mon Sep 17 00:00:00 2001
From: Jake Dane <3689-jakedane@users.noreply.gitlab.gnome.org>
Date: Fri, 19 Aug 2022 06:12:25 +0000
Subject: [PATCH] jpeg: Increase memory limit for loading image data
As fix for security issue #205 when loading image data the memory size
was limited to 100 MB. That seemed like a good threshold. For larger
images, from around 18 megapixels (MP) and up though not for all such
images, this threshold was too low. Increasing the threshold too 300 MB
seems to work better and lets larger images load.
Fixes #216.
---
gdk-pixbuf/io-jpeg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index 22f4174fe..6317e20d3 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -1091,7 +1091,7 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
rc = jpeg_read_header (cinfo, TRUE);
context->src_initialized = TRUE;
- cinfo->mem->max_memory_to_use = 100 * 1024 * 1024;
+ cinfo->mem->max_memory_to_use = 300 * 1024 * 1024;
if (rc == JPEG_SUSPENDED)
continue;
--
2.37.3

View File

@ -2,7 +2,7 @@
Name: gdk-pixbuf2
Version: 2.42.9
Release: 1%{?dist}
Release: 2%{?dist}
Summary: An image loading library
License: LGPLv2+
@ -28,6 +28,9 @@ Requires: glib2%{?_isa} >= %{glib2_version}
# We also need MIME information at runtime
Requires: shared-mime-info
# https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/issues/216
Patch0: 0001-jpeg-Increase-memory-limit-for-loading-image-data.patch
%description
gdk-pixbuf is an image loading library that can be extended by loadable
modules for new image formats. It is used by toolkits such as GTK+ or
@ -125,6 +128,9 @@ gdk-pixbuf-query-loaders-%{__isa_bits} --update-cache
%{_datadir}/installed-tests
%changelog
* Wed Sep 28 2022 Bastien Nocera <bnocera@redhat.com> - 2.42.9-2
- Fix loading of large JPEG files
* Wed Aug 10 2022 Kalev Lember <klember@redhat.com> - 2.42.9-1
- Update to 2.42.9