Skip to contentSkip to conversation

package/giflib: add two upstream security fixes

PATCH New Fabrice Fontaine 2 participants 6 messages Aug 19, 2019 – Sep 2, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 package/giflib: add two upstream security fixes

- Fix CVE-2018-11490: The DGifDecompressLine function in dgif_lib.c in GIFLIB (possibly version 3.0.x), as later shipped in cgif.c in sam2p 0.49.4, has a heap-based buffer overflow because a certain "Private->RunningCode - 2" array index is not checked. This will lead to a denial of service or possibly unspecified other impact.

- Fix CVE-2019-15133: In GIFLIB before 2019-02-16, a malformed GIF file triggers a divide-by-zero exception in the decoder function DGifSlurp in dgif_lib.c if the height field of the ImageSize data structure is equal to zero.

---
 ...13-Heap-Buffer-Overflow-2-in-functio.patch | 31 +++++++++++++++++++
 ...19-MemorySanitizer-FPE-on-unknown-ad.patch | 28 +++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 package/giflib/0001-Address-SF-bug-113-Heap-Buffer-Overflow-2-in-functio.patch
 create mode 100644 package/giflib/0002-Address-SF-bug-119-MemorySanitizer-FPE-on-unknown-ad.patch
package/giflib/0001-Address-SF-bug-113-Heap-Buffer-Overflow-2-in-functio.patch new file +31 -0
new file mode 100644
index 0000000000..9c6f344be8
@@ -0,0 +1,31 @@
+From 08438a5098f3bb1de23a29334af55eba663f75bd Mon Sep 17 00:00:00 2001
+From: "Eric S. Raymond" <[email protected]>
+Date: Sat, 9 Feb 2019 10:52:21 -0500
+Subject: [PATCH] Address SF bug #113: Heap Buffer Overflow-2 in function
+ DGifDecompressLine()...
+
+This was CVE-2018-11490
+
+[Retrieved from:
+https://sourceforge.net/p/giflib/code/ci/08438a5098f3bb1de23a29334af55eba663f75bd]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ lib/dgif_lib.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/dgif_lib.c b/lib/dgif_lib.c
+index 15c1460..c4aee5f 100644
+--- a/lib/dgif_lib.c
++++ b/lib/dgif_lib.c
+@@ -930,7 +930,7 @@ DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, int LineLen)
+                 while (StackPtr != 0 && i < LineLen)
+                     Line[i++] = Stack[--StackPtr];
+             }
+-            if (LastCode != NO_SUCH_CODE && Prefix[Private->RunningCode - 2] == NO_SUCH_CODE) {
++            if (LastCode != NO_SUCH_CODE && Private->RunningCode - 2 < LZ_MAX_CODE && Prefix[Private->RunningCode - 2] == NO_SUCH_CODE) {
+                 Prefix[Private->RunningCode - 2] = LastCode;
+ 
+                 if (CrntCode == Private->RunningCode - 2) {
+-- 
+2.20.1
+
package/giflib/0002-Address-SF-bug-119-MemorySanitizer-FPE-on-unknown-ad.patch new file +28 -0
new file mode 100644
index 0000000000..60e9a324a2
@@ -0,0 +1,28 @@
+From 799eb6a3af8a3dd81e2429bf11a72a57e541f908 Mon Sep 17 00:00:00 2001
+From: "Eric S. Raymond" <[email protected]>
+Date: Sun, 17 Mar 2019 12:37:21 -0400
+Subject: [PATCH] Address SF bug #119: MemorySanitizer: FPE on unknown address
+
+[Retrieved (and backported) from:
+https://sourceforge.net/p/giflib/code/ci/08438a5098f3bb1de23a29334af55eba663f75bd]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ dgif_lib.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/dgif_lib.c b/lib/dgif_lib.c
+index 3a52467..179bd84 100644
+--- a/lib/dgif_lib.c
++++ b/lib/dgif_lib.c
+@@ -1143,7 +1143,7 @@ DGifSlurp(GifFileType *GifFile)
+ 
+               sp = &GifFile->SavedImages[GifFile->ImageCount - 1];
+               /* Allocate memory for the image */
+-              if (sp->ImageDesc.Width < 0 && sp->ImageDesc.Height < 0 &&
++              if (sp->ImageDesc.Width <= 0 || sp->ImageDesc.Height <= 0 ||
+                       sp->ImageDesc.Width > (INT_MAX / sp->ImageDesc.Height)) {
+                   return GIF_ERROR;
+               }
+-- 
+2.20.1
+
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 2/2 package/giflib: bump to version 5.2.1

- Switch to generic-package (autotools has been dropped since version 5.1.5)
- Remove hook and instead use dedicated makefile targets to build only shared or static library and not binaries or documentation (added by an upstreamble patch)
- ac_cv_prog_have_xmlto=no can be removed as doc is not built anymore

---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Split CVE patches in a dedicated patch for master, bump is for next

 ...13-Heap-Buffer-Overflow-2-in-functio.patch | 31 ---------
 ...dd-targets-to-manage-static-building.patch | 69 +++++++++++++++++++
 ...19-MemorySanitizer-FPE-on-unknown-ad.patch | 28 --------
 package/giflib/giflib.hash                    |  4 +-
 package/giflib/giflib.mk                      | 47 +++++++++----
 5 files changed, 104 insertions(+), 75 deletions(-)
 delete mode 100644 package/giflib/0001-Address-SF-bug-113-Heap-Buffer-Overflow-2-in-functio.patch
 create mode 100644 package/giflib/0001-Makefile-add-targets-to-manage-static-building.patch
 delete mode 100644 package/giflib/0002-Address-SF-bug-119-MemorySanitizer-FPE-on-unknown-ad.patch
package/giflib/0001-Address-SF-bug-113-Heap-Buffer-Overflow-2-in-functio.patch deleted +0 -31
deleted file mode 100644
index 9c6f344be8..0000000000
@@ -1,31 +0,0 @@
-From 08438a5098f3bb1de23a29334af55eba663f75bd Mon Sep 17 00:00:00 2001
-From: "Eric S. Raymond" <[email protected]>
-Date: Sat, 9 Feb 2019 10:52:21 -0500
-Subject: [PATCH] Address SF bug #113: Heap Buffer Overflow-2 in function
- DGifDecompressLine()...
-
-This was CVE-2018-11490
-
-[Retrieved from:
-https://sourceforge.net/p/giflib/code/ci/08438a5098f3bb1de23a29334af55eba663f75bd]
-Signed-off-by: Fabrice Fontaine <[email protected]>
----
- lib/dgif_lib.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/dgif_lib.c b/lib/dgif_lib.c
-index 15c1460..c4aee5f 100644
---- a/lib/dgif_lib.c
-+++ b/lib/dgif_lib.c
-@@ -930,7 +930,7 @@ DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, int LineLen)
-                 while (StackPtr != 0 && i < LineLen)
-                     Line[i++] = Stack[--StackPtr];
-             }
--            if (LastCode != NO_SUCH_CODE && Prefix[Private->RunningCode - 2] == NO_SUCH_CODE) {
-+            if (LastCode != NO_SUCH_CODE && Private->RunningCode - 2 < LZ_MAX_CODE && Prefix[Private->RunningCode - 2] == NO_SUCH_CODE) {
-                 Prefix[Private->RunningCode - 2] = LastCode;
- 
-                 if (CrntCode == Private->RunningCode - 2) {
--- 
-2.20.1
-
package/giflib/0001-Makefile-add-targets-to-manage-static-building.patch new file +69 -0

69 lines not on this page · raw message

package/giflib/0002-Address-SF-bug-119-MemorySanitizer-FPE-on-unknown-ad.patch deleted +0 -28
deleted file mode 100644
index 60e9a324a2..0000000000
@@ -1,28 +0,0 @@
-From 799eb6a3af8a3dd81e2429bf11a72a57e541f908 Mon Sep 17 00:00:00 2001
-From: "Eric S. Raymond" <[email protected]>
-Date: Sun, 17 Mar 2019 12:37:21 -0400
-Subject: [PATCH] Address SF bug #119: MemorySanitizer: FPE on unknown address
-
-[Retrieved (and backported) from:
-https://sourceforge.net/p/giflib/code/ci/08438a5098f3bb1de23a29334af55eba663f75bd]
-Signed-off-by: Fabrice Fontaine <[email protected]>
----
- dgif_lib.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/dgif_lib.c b/lib/dgif_lib.c
-index 3a52467..179bd84 100644
---- a/lib/dgif_lib.c
-+++ b/lib/dgif_lib.c
-@@ -1143,7 +1143,7 @@ DGifSlurp(GifFileType *GifFile)
- 
-               sp = &GifFile->SavedImages[GifFile->ImageCount - 1];
-               /* Allocate memory for the image */
--              if (sp->ImageDesc.Width < 0 && sp->ImageDesc.Height < 0 &&
-+              if (sp->ImageDesc.Width <= 0 || sp->ImageDesc.Height <= 0 ||
-                       sp->ImageDesc.Width > (INT_MAX / sp->ImageDesc.Height)) {
-                   return GIF_ERROR;
-               }
--- 
-2.20.1
-
package/giflib/giflib.hash +2 -2
index 189dca9f19..f7db1626df 100644
@@ -1,5 +1,5 @@
 # From http://sourceforge.net/projects/giflib/files
-md5	2c171ced93c0e83bb09e6ccad8e3ba2b	giflib-5.1.4.tar.bz2
-sha1	5f1157cfc377916280849e247b8e34fa0446513f	giflib-5.1.4.tar.bz2
+md5	6f03aee4ebe54ac2cc1ab3e4b0a049e5	giflib-5.2.1.tar.gz
+sha1	c3f774dcbdf26afded7788979c8081d33c6426dc	giflib-5.2.1.tar.gz
 # Locally computed
 sha256	0c9b7990ecdca88b676db232c226548ac408b279f550d424d996f0d83591dd8e	COPYING
package/giflib/giflib.mk +33 -14

60 lines not on this page · raw message

Signature · 1 line
2.20.1
#2 lore raw

PATCH v2 2/2 package/giflib: bump to version 5.2.1

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

- Switch to generic-package (autotools has been dropped since version 5.1.5)
- Remove hook and instead use dedicated makefile targets to build only shared or static library and not binaries or documentation (added by an upstreamble patch)
- ac_cv_prog_have_xmlto=no can be removed as doc is not built anymore

Quoted 4 lines

---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Split CVE patches in a dedicated patch for master, bump is for next

Committed to next after cherry picking patch 1/2, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH v2 2/2 package/giflib: bump to version 5.2.1

Quoted 10 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"Peter" == Peter Korsgaard <[email protected]> writes:

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

- Switch to generic-package (autotools has been dropped since version 5.1.5)
- Remove hook and instead use dedicated makefile targets to build only shared or static library and not binaries or documentation (added by an upstreamble patch)
- ac_cv_prog_have_xmlto=no can be removed as doc is not built anymore

Quoted 6 lines
Quoted 4 lines

---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Split CVE patches in a dedicated patch for master, bump is for next

Committed to next after cherry picking patch 1/2, thanks.

After dropping the redundant GIFLIB_SOURCE as pointed out by check-package.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH v2 1/2 package/giflib: add two upstream security fixes

In reply to Fabrice Fontaine
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

- Fix CVE-2018-11490: The DGifDecompressLine function in dgif_lib.c in GIFLIB (possibly version 3.0.x), as later shipped in cgif.c in sam2p 0.49.4, has a heap-based buffer overflow because a certain "Private->RunningCode - 2" array index is not checked. This will lead to a denial of service or possibly unspecified other impact.

Quoted 6 lines

- Fix CVE-2019-15133: In GIFLIB before 2019-02-16, a malformed GIF file triggers a divide-by-zero exception in the decoder function DGifSlurp in dgif_lib.c if the height field of the ImageSize data structure is equal to zero.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH v2 1/2 package/giflib: add two upstream security fixes

In reply to Fabrice Fontaine
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

- Fix CVE-2018-11490: The DGifDecompressLine function in dgif_lib.c in GIFLIB (possibly version 3.0.x), as later shipped in cgif.c in sam2p 0.49.4, has a heap-based buffer overflow because a certain "Private->RunningCode - 2" array index is not checked. This will lead to a denial of service or possibly unspecified other impact.

Quoted 6 lines

- Fix CVE-2019-15133: In GIFLIB before 2019-02-16, a malformed GIF file triggers a divide-by-zero exception in the decoder function DGifSlurp in dgif_lib.c if the height field of the ImageSize data structure is equal to zero.

Committed to 2019.02.x and 2019.05.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard