mirror of
https://git.freebsd.org/ports.git
synced 2025-06-08 14:20:33 -04:00
- Resolve backlog of CVEs PR: 201513 Reported by: Sevan Janiyan Submitted by: Jason Unovitch (maintainer) Security: CVE-2004-0941 [1] Security: CVE-2007-0455 [1] Security: CVE-2007-2756 [1] Security: CVE-2007-3472 [1] Security: CVE-2007-3473 [1] Security: CVE-2007-3477 [1] Security: CVE-2009-3546 [1] Security: CVE-2015-4695 [2] Security: CVE-2015-4696 [3] Security: CVE-2015-0848 [4] Security: CVE-2015-4588 [4] Security: ca139c7f-2a8c-11e5-a4a5-002590263bf5 Obtained From: CentOS libwmf RPM git [1] Obtained From: Debian Bug 784205 [2] Obtained From: Debian Bug 784192 [3] Obtained From: Red Hat Bug 1227243 [4] MFH: 2015Q3
61 lines
1.5 KiB
Text
61 lines
1.5 KiB
Text
Patch modified slightly from upstream CentOS version
|
|
|
|
--- src/extra/gd/gd.c
|
|
+++ src/extra/gd/gd.c
|
|
@@ -106,6 +106,18 @@
|
|
gdImagePtr im;
|
|
unsigned long cpa_size;
|
|
|
|
+ if (overflow2(sx, sy)) {
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
+ if (overflow2(sizeof (int *), sy)) {
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
+ if (overflow2(sizeof(int), sx)) {
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
im = (gdImage *) gdMalloc (sizeof (gdImage));
|
|
if (im == 0) return 0;
|
|
memset (im, 0, sizeof (gdImage));
|
|
--- src/extra/gd/gdhelpers.c 2010-12-06 11:47:31.000000000 +0000
|
|
+++ src/extra/gd/gdhelpers.c 2010-12-06 11:48:04.000000000 +0000
|
|
@@ -2,6 +2,7 @@
|
|
#include "gdhelpers.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
+#include <limits.h>
|
|
|
|
/* TBB: gd_strtok_r is not portable; provide an implementation */
|
|
|
|
@@ -94,3 +95,18 @@
|
|
{
|
|
free (ptr);
|
|
}
|
|
+
|
|
+int overflow2(int a, int b)
|
|
+{
|
|
+ if(a < 0 || b < 0) {
|
|
+ fprintf(stderr, "gd warning: one parameter to a memory allocation multiplication is negative, failing operation gracefully\n");
|
|
+ return 1;
|
|
+ }
|
|
+ if(b == 0)
|
|
+ return 0;
|
|
+ if(a > INT_MAX / b) {
|
|
+ fprintf(stderr, "gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
|
|
+ return 1;
|
|
+ }
|
|
+ return 0;
|
|
+}
|
|
--- src/extra/gd/gdhelpers.h 2010-12-06 11:47:17.000000000 +0000
|
|
+++ src/extra/gd/gdhelpers.h 2010-12-06 11:48:36.000000000 +0000
|
|
@@ -15,4 +15,6 @@
|
|
void *gdMalloc(size_t size);
|
|
void *gdRealloc(void *ptr, size_t size);
|
|
|
|
+int overflow2(int a, int b);
|
|
+
|
|
#endif /* GDHELPERS_H */
|