mirror of
https://git.freebsd.org/ports.git
synced 2025-07-16 16:59:17 -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
111 lines
3.1 KiB
Text
111 lines
3.1 KiB
Text
diff -ru src/ipa/ipa/bmp.h src/ipa/ipa/bmp.h
|
|
--- src/ipa/ipa/bmp.h 2015-06-03 09:30:59.410501271 +0100
|
|
+++ src/ipa/ipa/bmp.h 2015-06-03 09:31:05.775572630 +0100
|
|
@@ -859,7 +859,7 @@
|
|
%
|
|
%
|
|
*/
|
|
-static void DecodeImage (wmfAPI* API,wmfBMP* bmp,BMPSource* src,unsigned int compression,unsigned char* pixels)
|
|
+static int DecodeImage (wmfAPI* API,wmfBMP* bmp,BMPSource* src,unsigned int compression,unsigned char* pixels)
|
|
{ int byte;
|
|
int count;
|
|
int i;
|
|
@@ -870,12 +870,14 @@
|
|
U32 u;
|
|
|
|
unsigned char* q;
|
|
+ unsigned char* end;
|
|
|
|
for (u = 0; u < ((U32) bmp->width * (U32) bmp->height); u++) pixels[u] = 0;
|
|
|
|
byte = 0;
|
|
x = 0;
|
|
q = pixels;
|
|
+ end = pixels + bmp->width * bmp->height;
|
|
|
|
for (y = 0; y < bmp->height; )
|
|
{ count = ReadBlobByte (src);
|
|
@@ -884,7 +886,10 @@
|
|
{ /* Encoded mode. */
|
|
byte = ReadBlobByte (src);
|
|
for (i = 0; i < count; i++)
|
|
- { if (compression == 1)
|
|
+ {
|
|
+ if (q == end)
|
|
+ return 0;
|
|
+ if (compression == 1)
|
|
{ (*(q++)) = (unsigned char) byte;
|
|
}
|
|
else
|
|
@@ -896,13 +901,15 @@
|
|
else
|
|
{ /* Escape mode. */
|
|
count = ReadBlobByte (src);
|
|
- if (count == 0x01) return;
|
|
+ if (count == 0x01) return 1;
|
|
switch (count)
|
|
{
|
|
case 0x00:
|
|
{ /* End of line. */
|
|
x = 0;
|
|
y++;
|
|
+ if (y >= bmp->height)
|
|
+ return 0;
|
|
q = pixels + y * bmp->width;
|
|
break;
|
|
}
|
|
@@ -910,13 +917,20 @@
|
|
{ /* Delta mode. */
|
|
x += ReadBlobByte (src);
|
|
y += ReadBlobByte (src);
|
|
+ if (y >= bmp->height)
|
|
+ return 0;
|
|
+ if (x >= bmp->width)
|
|
+ return 0;
|
|
q = pixels + y * bmp->width + x;
|
|
break;
|
|
}
|
|
default:
|
|
{ /* Absolute mode. */
|
|
for (i = 0; i < count; i++)
|
|
- { if (compression == 1)
|
|
+ {
|
|
+ if (q == end)
|
|
+ return 0;
|
|
+ if (compression == 1)
|
|
{ (*(q++)) = ReadBlobByte (src);
|
|
}
|
|
else
|
|
@@ -943,7 +957,7 @@
|
|
byte = ReadBlobByte (src); /* end of line */
|
|
byte = ReadBlobByte (src);
|
|
|
|
- return;
|
|
+ return 1;
|
|
}
|
|
|
|
/*
|
|
@@ -1146,7 +1160,10 @@
|
|
{
|
|
if (bmp_info.bits_per_pixel == 8) /* Convert run-length encoded raster pixels. */
|
|
{
|
|
- DecodeImage (API,bmp,src,(unsigned int) bmp_info.compression,data->image);
|
|
+ if (!DecodeImage (API,bmp,src,(unsigned int) bmp_info.compression,data->image))
|
|
+ { WMF_ERROR (API,"corrupt bmp");
|
|
+ API->err = wmf_E_BadFormat;
|
|
+ }
|
|
}
|
|
else
|
|
{ WMF_ERROR (API,"Unexpected pixel depth");
|
|
diff -ru src/ipa/ipa.h src/ipa/ipa.h
|
|
--- src/ipa/ipa.h 2015-06-03 09:30:59.410501271 +0100
|
|
+++ src/ipa/ipa.h 2015-06-03 09:31:08.687605277 +0100
|
|
@@ -48,7 +48,7 @@
|
|
static unsigned short ReadBlobLSBShort (BMPSource*);
|
|
static unsigned long ReadBlobLSBLong (BMPSource*);
|
|
static long TellBlob (BMPSource*);
|
|
-static void DecodeImage (wmfAPI*,wmfBMP*,BMPSource*,unsigned int,unsigned char*);
|
|
+static int DecodeImage (wmfAPI*,wmfBMP*,BMPSource*,unsigned int,unsigned char*);
|
|
static void ReadBMPImage (wmfAPI*,wmfBMP*,BMPSource*);
|
|
static int ExtractColor (wmfAPI*,wmfBMP*,wmfRGB*,unsigned int,unsigned int);
|
|
static void SetColor (wmfAPI*,wmfBMP*,wmfRGB*,unsigned char,unsigned int,unsigned int);
|