libwmf: add proper CVE tag to patch
PATCH 1/6 libwmf: add proper CVE tag to patch
CVE-2009-1364 is already patched, but the patch didn't contain the necessary tag so the cve-checker didn't pick it up.
This change adds the required tag.
--- .../libwmf/libwmf/libwmf-0.2.8.4-useafterfree.patch | 2 ++ 1 file changed, 2 insertions(+)
meta-oe/recipes-extended/libwmf/libwmf/libwmf-0.2.8.4-useafterfree.patch +2 -0
@@ -2,6 +2,8 @@ http://cvs.fedoraproject.org/viewvc/devel/libwmf/libwmf-0.2.8.4-useafterfree.patch?view=log Resolves: CVE-2009-1364 +CVE: CVE-2009-1364 + --- libwmf-0.2.8.4/src/extra/gd/gd_clip.c.CVE-2009-1364-im-clip-list 2009-04-24 04:06:44.000000000 -0400 +++ libwmf-0.2.8.4/src/extra/gd/gd_clip.c 2009-04-24 04:08:30.000000000 -0400 @@ -70,6 +70,7 @@ void gdClipSetAdd(gdImagePtr im,gdClipRe
PATCH 2/6 libwmf: add missing CVE tag to patch
CVE-2006-3376 is already patched, but the patch is missing the required CVE tag, so the cve-checker misses it.
This patch adds the tag.
--- .../libwmf/libwmf/libwmf-0.2.8.4-intoverflow.patch | 2 ++ 1 file changed, 2 insertions(+)
meta-oe/recipes-extended/libwmf/libwmf/libwmf-0.2.8.4-intoverflow.patch +2 -0
@@ -2,6 +2,8 @@ http://cvs.fedoraproject.org/viewvc/devel/libwmf/libwmf-0.2.8.4-intoverflow.patc CVE-2006-3376 libwmf integer overflow +CVE: CVE-2006-3376 + --- libwmf-0.2.8.4.orig/src/player.c 2002-12-10 19:30:26.000000000 +0000 +++ libwmf-0.2.8.4/src/player.c 2006-07-12 15:12:52.000000000 +0100 @@ -42,6 +42,7 @@
PATCH 3/6 libwmf: patch CVE-2015-0848 and CVE-2015-4588
In reply to Gyorgy SarvariDetails:
https://nvd.nist.gov/vuln/detail/CVE-2015-0848
https://nvd.nist.gov/vuln/detail/CVE-2015-4588
Pick the commit that mentions the CVE IDs explicitly. The same patch fixes both vulnerabilities.
--- .../libwmf/CVE-2015-0848-CVE-2015-4588.patch | 135 ++++++++++++++++++ .../recipes-extended/libwmf/libwmf_0.2.8.4.bb | 3 +- 2 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-extended/libwmf/libwmf/CVE-2015-0848-CVE-2015-4588.patch
meta-oe/recipes-extended/libwmf/libwmf/CVE-2015-0848-CVE-2015-4588.patch new file +135 -0
@@ -0,0 +1,135 @@ +From f42e4f4505b07278f4baccddfc1f47059ae4f931 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <[email protected]> +Date: Wed, 8 Aug 2018 13:59:18 +0100 +Subject: [PATCH] CVE-2015-0848+CVE-2015-4588 + +CVE: CVE-2015-0848 CVE-2015-4588 +Upstream-Status: Backport [https://github.com/caolanm/libwmf/commit/879d6bffa6dd21b8c0e9ec3b5aa31b6ae090ef83] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + src/ipa/ipa.h | 2 +- + src/ipa/ipa/bmp.h | 38 +++++++++++++++++++++++++++++++------- + 2 files changed, 32 insertions(+), 8 deletions(-) + +diff --git a/src/ipa/ipa.h b/src/ipa/ipa.h +index d050a7e..3003540 100644 +--- a/src/ipa/ipa.h ++++ b/src/ipa/ipa.h +@@ -48,7 +48,7 @@ static int ReadBlobByte (BMPSource*); + 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); +diff --git a/src/ipa/ipa/bmp.h b/src/ipa/ipa/bmp.h +index 29eee34..7751a36 100644 +--- a/src/ipa/ipa/bmp.h ++++ b/src/ipa/ipa/bmp.h +@@ -859,7 +859,7 @@ static long TellBlob (BMPSource* src) + % + % + */ +-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 @@ static void DecodeImage (wmfAPI* API,wmfBMP* bmp,BMPSource* src,unsigned int com + 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 @@ static void DecodeImage (wmfAPI* API,wmfBMP* bmp,BMPSource* src,unsigned int com + { /* 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 @@ static void DecodeImage (wmfAPI* API,wmfBMP* bmp,BMPSource* src,unsigned int com + 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 @@ static void DecodeImage (wmfAPI* API,wmfBMP* bmp,BMPSource* src,unsigned int com + { /* 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 @@ static void DecodeImage (wmfAPI* API,wmfBMP* bmp,BMPSource* src,unsigned int com + byte = ReadBlobByte (src); /* end of line */ + byte = ReadBlobByte (src); + +- return; ++ return 1; + } + + /* +@@ -1143,8 +1157,18 @@ static void ReadBMPImage (wmfAPI* API,wmfBMP* bmp,BMPSource* src) + } + } + else +- { /* Convert run-length encoded raster pixels. */ +- DecodeImage (API,bmp,src,(unsigned int) bmp_info.compression,data->image); ++ { ++ if (bmp_info.bits_per_pixel == 8) /* Convert run-length encoded raster pixels. */ ++ { ++ 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"); ++ API->err = wmf_E_BadFormat; ++ } + } + + if (ERR (API))
meta-oe/recipes-extended/libwmf/libwmf_0.2.8.4.bb +2 -1
@@ -20,7 +20,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/wvware/${BPN}/${PV}/${BPN}-${PV}.tar.gz;name=ta file://libwmf-0.2.8.4-intoverflow.patch \ file://libwmf-0.2.8.4-useafterfree.patch \ file://0001-configure-use-pkg-config-for-freetype.patch \ - " + file://CVE-2015-0848-CVE-2015-4588.patch \ + " SRC_URI[tarball.md5sum] = "d1177739bf1ceb07f57421f0cee191e0" SRC_URI[tarball.sha256sum] = "5b345c69220545d003ad52bfd035d5d6f4f075e65204114a9e875e84895a7cf8"
PATCH 4/6 libwmf: patch CVE-2015-4695
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2015-4695
Pick the commit that explicitly mentions the vulnerability ID.
--- .../libwmf/libwmf/CVE-2015-4695.patch | 70 +++++++++++++++++++ .../recipes-extended/libwmf/libwmf_0.2.8.4.bb | 1 + 2 files changed, 71 insertions(+) create mode 100644 meta-oe/recipes-extended/libwmf/libwmf/CVE-2015-4695.patch
meta-oe/recipes-extended/libwmf/libwmf/CVE-2015-4695.patch new file +70 -0
@@ -0,0 +1,70 @@ +From 7a7f58c0ebb84b9a3c44c875a667ce8ba191b325 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <[email protected]> +Date: Wed, 8 Aug 2018 13:59:37 +0100 +Subject: [PATCH] CVE-2015-4695 + +CVE: CVE-2015-4695 +Upstream-Status: Backport [https://github.com/caolanm/libwmf/commit/b5ae5d1f3bbddf051a5c9dd01897bd835817f013] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + src/player/meta.h | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/player/meta.h b/src/player/meta.h +index 252e68b..3e13688 100644 +--- a/src/player/meta.h ++++ b/src/player/meta.h +@@ -1565,7 +1565,7 @@ static int meta_rgn_create (wmfAPI* API,wmfRecord* Record,wmfAttributes* attrlis + objects = P->objects; + + i = 0; +- while (objects[i].type && (i < NUM_OBJECTS (API))) i++; ++ while ((i < NUM_OBJECTS (API)) && objects[i].type) i++; + + if (i == NUM_OBJECTS (API)) + { WMF_ERROR (API,"Object out of range!"); +@@ -2142,7 +2142,7 @@ static int meta_dib_brush (wmfAPI* API,wmfRecord* Record,wmfAttributes* attrlist + objects = P->objects; + + i = 0; +- while (objects[i].type && (i < NUM_OBJECTS (API))) i++; ++ while ((i < NUM_OBJECTS (API)) && objects[i].type) i++; + + if (i == NUM_OBJECTS (API)) + { WMF_ERROR (API,"Object out of range!"); +@@ -3067,7 +3067,7 @@ static int meta_pen_create (wmfAPI* API,wmfRecord* Record,wmfAttributes* attrlis + objects = P->objects; + + i = 0; +- while (objects[i].type && (i < NUM_OBJECTS (API))) i++; ++ while ((i < NUM_OBJECTS (API)) && objects[i].type) i++; + + if (i == NUM_OBJECTS (API)) + { WMF_ERROR (API,"Object out of range!"); +@@ -3181,7 +3181,7 @@ static int meta_brush_create (wmfAPI* API,wmfRecord* Record,wmfAttributes* attrl + objects = P->objects; + + i = 0; +- while (objects[i].type && (i < NUM_OBJECTS (API))) i++; ++ while ((i < NUM_OBJECTS (API)) && objects[i].type) i++; + + if (i == NUM_OBJECTS (API)) + { WMF_ERROR (API,"Object out of range!"); +@@ -3288,7 +3288,7 @@ static int meta_font_create (wmfAPI* API,wmfRecord* Record,wmfAttributes* attrli + objects = P->objects; + + i = 0; +- while (objects[i].type && (i < NUM_OBJECTS (API))) i++; ++ while ((i < NUM_OBJECTS (API)) && objects[i].type) i++; + + if (i == NUM_OBJECTS (API)) + { WMF_ERROR (API,"Object out of range!"); +@@ -3396,7 +3396,7 @@ static int meta_palette_create (wmfAPI* API,wmfRecord* Record,wmfAttributes* att + objects = P->objects; + + i = 0; +- while (objects[i].type && (i < NUM_OBJECTS (API))) i++; ++ while ((i < NUM_OBJECTS (API)) && objects[i].type) i++; + + if (i == NUM_OBJECTS (API)) + { WMF_ERROR (API,"Object out of range!");
meta-oe/recipes-extended/libwmf/libwmf_0.2.8.4.bb +1 -0
@@ -21,6 +21,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/wvware/${BPN}/${PV}/${BPN}-${PV}.tar.gz;name=ta file://libwmf-0.2.8.4-useafterfree.patch \ file://0001-configure-use-pkg-config-for-freetype.patch \ file://CVE-2015-0848-CVE-2015-4588.patch \ + file://CVE-2015-4695.patch \ " SRC_URI[tarball.md5sum] = "d1177739bf1ceb07f57421f0cee191e0"
PATCH 5/6 libwmf: patch CVE-2015-4696
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2015-4696
Pick the patch that mentions the vulnerability ID explicitly.
--- .../libwmf/libwmf/CVE-2015-4696.patch | 37 +++++++++++++++++++ .../recipes-extended/libwmf/libwmf_0.2.8.4.bb | 1 + 2 files changed, 38 insertions(+) create mode 100644 meta-oe/recipes-extended/libwmf/libwmf/CVE-2015-4696.patch
meta-oe/recipes-extended/libwmf/libwmf/CVE-2015-4696.patch new file +37 -0
@@ -0,0 +1,37 @@ +From f743ef455dfb1faade0ca5290994087ef8b12a98 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <[email protected]> +Date: Wed, 8 Aug 2018 14:00:49 +0100 +Subject: [PATCH] CVE-2015-4696 + +CVE: CVE-2015-4696 +Upstream-Status: Backport [https://github.com/caolanm/libwmf/commit/f47cbdf96838c2daa7b8e489f59e62371d33352a] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + src/player/meta.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/player/meta.h b/src/player/meta.h +index 3e13688..f86c5f9 100644 +--- a/src/player/meta.h ++++ b/src/player/meta.h +@@ -2585,6 +2585,8 @@ static int meta_dc_restore (wmfAPI* API,wmfRecord* Record,wmfAttributes* attrlis + polyrect.BR[i] = clip->rects[i].BR; + } + ++ if (FR->region_clip) FR->region_clip (API,&polyrect); ++ + wmf_free (API,polyrect.TL); + wmf_free (API,polyrect.BR); + } +@@ -2593,9 +2595,10 @@ static int meta_dc_restore (wmfAPI* API,wmfRecord* Record,wmfAttributes* attrlis + polyrect.BR = 0; + + polyrect.count = 0; ++ ++ if (FR->region_clip) FR->region_clip (API,&polyrect); + } + +- if (FR->region_clip) FR->region_clip (API,&polyrect); + + return (changed); + }
meta-oe/recipes-extended/libwmf/libwmf_0.2.8.4.bb +1 -0
@@ -22,6 +22,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/wvware/${BPN}/${PV}/${BPN}-${PV}.tar.gz;name=ta file://0001-configure-use-pkg-config-for-freetype.patch \ file://CVE-2015-0848-CVE-2015-4588.patch \ file://CVE-2015-4695.patch \ + file://CVE-2015-4696.patch \ " SRC_URI[tarball.md5sum] = "d1177739bf1ceb07f57421f0cee191e0"
PATCH 6/6 libwmf: patch CVE-2016-9011
In reply to Gyorgy SarvariDetails: https://nvd.nist.gov/vuln/detail/CVE-2016-9011
Pick the patch that explicitly mentions the vulnerability ID.
--- .../libwmf/libwmf/CVE-2016-9011.patch | 50 +++++++++++++++++++ .../recipes-extended/libwmf/libwmf_0.2.8.4.bb | 1 + 2 files changed, 51 insertions(+) create mode 100644 meta-oe/recipes-extended/libwmf/libwmf/CVE-2016-9011.patch
meta-oe/recipes-extended/libwmf/libwmf/CVE-2016-9011.patch new file +50 -0
@@ -0,0 +1,50 @@ +From 245ec5c80d8d9964d150507f5583ab890a327fe8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <[email protected]> +Date: Wed, 8 Aug 2018 14:01:34 +0100 +Subject: [PATCH] CVE-2016-9011 + +CVE: CVE-2016-9011 +Upstream-Status: Backport [https://github.com/caolanm/libwmf/commit/2208b4881ceb8056480735dc330cfd52be03893e] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + src/player.c | 27 +++++++++++++++++++++++++-- + 1 file changed, 25 insertions(+), 2 deletions(-) + +diff --git a/src/player.c b/src/player.c +index cd87cb5..628cdcb 100644 +--- a/src/player.c ++++ b/src/player.c +@@ -139,8 +139,31 @@ wmf_error_t wmf_scan (wmfAPI* API,unsigned long flags,wmfD_Rect* d_r) + WMF_DEBUG (API,"bailing..."); + return (API->err); + } +- +- P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API) ) * 2 * sizeof (unsigned char)); ++ ++ U32 nMaxRecordSize = (MAX_REC_SIZE(API) ) * 2 * sizeof (unsigned char); ++ if (nMaxRecordSize) ++ { ++ //before allocating memory do a sanity check on size by seeking ++ //to claimed end to see if its possible. We're constrained here ++ //by the api and existing implementations to not simply seeking ++ //to SEEK_END. So use what we have to skip to the last byte and ++ //try and read it. ++ const long nPos = WMF_TELL (API); ++ WMF_SEEK (API, nPos + nMaxRecordSize - 1); ++ if (ERR (API)) ++ { WMF_DEBUG (API,"bailing..."); ++ return (API->err); ++ } ++ int byte = WMF_READ (API); ++ if (byte == (-1)) ++ { WMF_ERROR (API,"Unexpected EOF!"); ++ API->err = wmf_E_EOF; ++ return (API->err); ++ } ++ WMF_SEEK (API, nPos); ++ } ++ ++ P->Parameters = (unsigned char*) wmf_malloc (API, nMaxRecordSize); + + if (ERR (API)) + { WMF_DEBUG (API,"bailing...");
meta-oe/recipes-extended/libwmf/libwmf_0.2.8.4.bb +1 -0
@@ -23,6 +23,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/wvware/${BPN}/${PV}/${BPN}-${PV}.tar.gz;name=ta file://CVE-2015-0848-CVE-2015-4588.patch \ file://CVE-2015-4695.patch \ file://CVE-2015-4696.patch \ + file://CVE-2016-9011.patch \ " SRC_URI[tarball.md5sum] = "d1177739bf1ceb07f57421f0cee191e0"