diff -Nru gdk-pixbuf-2.42.2+dfsg/debian/changelog gdk-pixbuf-2.42.2+dfsg/debian/changelog --- gdk-pixbuf-2.42.2+dfsg/debian/changelog 2022-09-02 14:01:56.000000000 -0400 +++ gdk-pixbuf-2.42.2+dfsg/debian/changelog 2024-06-05 10:04:29.000000000 -0400 @@ -1,3 +1,15 @@ +gdk-pixbuf (2.42.2+dfsg-1+deb11u2) bullseye; urgency=high + + [ Ian Constantin ] + * SECURITY UPDATE: heap memory corruption (Closes: #1071265) + - debian/patches/CVE-2022-48622-*.patch: adds checks for invalid ani files + to gdk-pixbuf/io-ani.c. + - tests/tests-images/fail/CVE-2022-48622.ani: test file. + - debian/source/include-binaries: including binary test file. + - CVE-2022-48622 + + -- Jeremy BĂ­cha Wed, 05 Jun 2024 10:04:29 -0400 + gdk-pixbuf (2.42.2+dfsg-1+deb11u1) bullseye-security; urgency=high * Non-maintainer upload by the Security Team. diff -Nru gdk-pixbuf-2.42.2+dfsg/debian/gbp.conf gdk-pixbuf-2.42.2+dfsg/debian/gbp.conf --- gdk-pixbuf-2.42.2+dfsg/debian/gbp.conf 2022-08-28 07:12:33.000000000 -0400 +++ gdk-pixbuf-2.42.2+dfsg/debian/gbp.conf 2024-06-05 10:04:29.000000000 -0400 @@ -1,6 +1,6 @@ [DEFAULT] pristine-tar = True -debian-branch = debian/master +debian-branch = debian/bullseye upstream-branch = upstream/latest [buildpackage] diff -Nru gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-1.patch gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-1.patch --- gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-1.patch 1969-12-31 19:00:00.000000000 -0500 +++ gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-1.patch 2024-06-05 10:04:29.000000000 -0400 @@ -0,0 +1,37 @@ +From: Benjamin Gilbert +Date: Tue, 30 Apr 2024 07:26:54 -0500 +Subject: ANI: Reject files with multiple anih chunks + +An anih chunk causes us to initialize a bunch of state, which we only +expect to do once per file. + +Fixes: #202 +Fixes: CVE-2022-48622 +(cherry picked from commit 00c071dd11f723ca608608eef45cb1aa98da89cc) + +tests/test-images/fail/CVE-2022-48622.ani was committed separately +to allow this patch to be text instead of binary +--- + gdk-pixbuf/io-ani.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/gdk-pixbuf/io-ani.c b/gdk-pixbuf/io-ani.c +index c6c4642..a78ea7a 100644 +--- a/gdk-pixbuf/io-ani.c ++++ b/gdk-pixbuf/io-ani.c +@@ -295,6 +295,15 @@ ani_load_chunk (AniLoaderContext *context, GError **error) + + if (context->chunk_id == TAG_anih) + { ++ if (context->animation) ++ { ++ g_set_error_literal (error, ++ GDK_PIXBUF_ERROR, ++ GDK_PIXBUF_ERROR_CORRUPT_IMAGE, ++ _("Invalid header in animation")); ++ return FALSE; ++ } ++ + context->HeaderSize = read_int32 (context); + context->NumFrames = read_int32 (context); + context->NumSteps = read_int32 (context); diff -Nru gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-2.patch gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-2.patch --- gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-2.patch 1969-12-31 19:00:00.000000000 -0500 +++ gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-2.patch 2024-06-05 10:04:29.000000000 -0400 @@ -0,0 +1,32 @@ +From: Benjamin Gilbert +Date: Tue, 30 Apr 2024 07:13:37 -0500 +Subject: ANI: Reject files with multiple INAM or IART chunks + +There should be at most one chunk each. These would cause memory leaks +otherwise. +--- + gdk-pixbuf/io-ani.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gdk-pixbuf/io-ani.c b/gdk-pixbuf/io-ani.c +index a78ea7a..8e84141 100644 +--- a/gdk-pixbuf/io-ani.c ++++ b/gdk-pixbuf/io-ani.c +@@ -445,7 +445,7 @@ ani_load_chunk (AniLoaderContext *context, GError **error) + } + else if (context->chunk_id == TAG_INAM) + { +- if (!context->animation) ++ if (!context->animation || context->title) + { + g_set_error_literal (error, + GDK_PIXBUF_ERROR, +@@ -472,7 +472,7 @@ ani_load_chunk (AniLoaderContext *context, GError **error) + } + else if (context->chunk_id == TAG_IART) + { +- if (!context->animation) ++ if (!context->animation || context->author) + { + g_set_error_literal (error, + GDK_PIXBUF_ERROR, diff -Nru gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-3.patch gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-3.patch --- gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-3.patch 1969-12-31 19:00:00.000000000 -0500 +++ gdk-pixbuf-2.42.2+dfsg/debian/patches/CVE-2022-48622-3.patch 2024-06-05 10:04:29.000000000 -0400 @@ -0,0 +1,34 @@ +From: Benjamin Gilbert +Date: Tue, 30 Apr 2024 08:17:25 -0500 +Subject: ANI: Validate anih chunk size + +Before reading a chunk, we verify that enough bytes are available to match +the chunk size declared by the file. However, uniquely, the anih chunk +loader doesn't verify that this size matches the number of bytes it +actually intends to read. Thus, if the chunk size is too small and the +file ends in the middle of the chunk, we populate some context fields with +stack garbage. (But we'd still fail later on because the file doesn't +contain any images.) Fix this. +--- + gdk-pixbuf/io-ani.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/gdk-pixbuf/io-ani.c b/gdk-pixbuf/io-ani.c +index 8e84141..cfafd7b 100644 +--- a/gdk-pixbuf/io-ani.c ++++ b/gdk-pixbuf/io-ani.c +@@ -295,6 +295,14 @@ ani_load_chunk (AniLoaderContext *context, GError **error) + + if (context->chunk_id == TAG_anih) + { ++ if (context->chunk_size < 36) ++ { ++ g_set_error_literal (error, ++ GDK_PIXBUF_ERROR, ++ GDK_PIXBUF_ERROR_CORRUPT_IMAGE, ++ _("Malformed chunk in animation")); ++ return FALSE; ++ } + if (context->animation) + { + g_set_error_literal (error, diff -Nru gdk-pixbuf-2.42.2+dfsg/debian/patches/series gdk-pixbuf-2.42.2+dfsg/debian/patches/series --- gdk-pixbuf-2.42.2+dfsg/debian/patches/series 2022-09-02 13:55:41.000000000 -0400 +++ gdk-pixbuf-2.42.2+dfsg/debian/patches/series 2024-06-05 10:04:29.000000000 -0400 @@ -9,3 +9,6 @@ gif-Check-for-overflow-when-compositing-or-clearing-.patch Add-an-assertion-that-checks-for-maximum-LZW-code-si.patch Fix-the-check-for-maximum-value-of-LZW-initial-code-.patch +CVE-2022-48622-1.patch +CVE-2022-48622-2.patch +CVE-2022-48622-3.patch diff -Nru gdk-pixbuf-2.42.2+dfsg/debian/source/include-binaries gdk-pixbuf-2.42.2+dfsg/debian/source/include-binaries --- gdk-pixbuf-2.42.2+dfsg/debian/source/include-binaries 2022-09-02 13:56:35.000000000 -0400 +++ gdk-pixbuf-2.42.2+dfsg/debian/source/include-binaries 2024-06-05 10:04:29.000000000 -0400 @@ -1 +1,2 @@ debian/invalid-colors.gif +tests/test-images/fail/CVE-2022-48622.ani Binary files /tmp/ss2NWrUDyc/gdk-pixbuf-2.42.2+dfsg/tests/test-images/fail/CVE-2022-48622.ani and /tmp/3yBkDeGRJn/gdk-pixbuf-2.42.2+dfsg/tests/test-images/fail/CVE-2022-48622.ani differ