diff options
| author | Li Zhou <li.zhou@windriver.com> | 2017-01-25 17:28:22 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-31 14:43:01 +0000 |
| commit | 49f6a9e7949ec3bd774c8b8580a5f7d57502fd40 (patch) | |
| tree | 343de143e7f58c2b09650c4f9bceccbbb9ad3945 | |
| parent | 837fd055117f2e4c5c40162abe2e04eaabfeacde (diff) | |
| download | poky-49f6a9e7949ec3bd774c8b8580a5f7d57502fd40.tar.gz | |
libtiff: Security Advisory - libtiff - CVE-2017-5225
Libtiff is vulnerable to a heap buffer overflow in the tools/tiffcp
resulting in DoS or code execution via a crafted BitsPerSample value.
Porting patch from <https://github.com/vadz/libtiff/commit/
5c080298d59efa53264d7248bbe3a04660db6ef7> to solve CVE-2017-5225.
(From OE-Core rev: 434990304bdfb70441b399ff8998dbe3fe1b1e1f)
Signed-off-by: Li Zhou <li.zhou@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-multimedia/libtiff/files/libtiff-CVE-2017-5225.patch | 92 | ||||
| -rw-r--r-- | meta/recipes-multimedia/libtiff/tiff_4.0.7.bb | 1 |
2 files changed, 93 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/libtiff/files/libtiff-CVE-2017-5225.patch b/meta/recipes-multimedia/libtiff/files/libtiff-CVE-2017-5225.patch new file mode 100644 index 0000000000..3263353a75 --- /dev/null +++ b/meta/recipes-multimedia/libtiff/files/libtiff-CVE-2017-5225.patch | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | From a24df1e93833dfeaa69bf4d510518dc4684db64d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li Zhou <li.zhou@windriver.com> | ||
| 3 | Date: Wed, 25 Jan 2017 17:07:21 +0800 | ||
| 4 | Subject: [PATCH] libtiff: fix CVE-2017-5225 | ||
| 5 | |||
| 6 | tools/tiffcp.c: error out cleanly in cpContig2SeparateByRow | ||
| 7 | and cpSeparate2ContigByRow if BitsPerSample != 8 to avoid heap based | ||
| 8 | overflow. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2656 and | ||
| 9 | http://bugzilla.maptools.org/show_bug.cgi?id=2657 | ||
| 10 | |||
| 11 | Upstream-Status: Backport | ||
| 12 | CVE: CVE-2017-5225 | ||
| 13 | Signed-off-by: Li Zhou <li.zhou@windriver.com> | ||
| 14 | --- | ||
| 15 | ChangeLog | 7 +++++++ | ||
| 16 | tools/tiffcp.c | 24 ++++++++++++++++++++++-- | ||
| 17 | 2 files changed, 29 insertions(+), 2 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/ChangeLog b/ChangeLog | ||
| 20 | index 9b9d397..7e82795 100644 | ||
| 21 | --- a/ChangeLog | ||
| 22 | +++ b/ChangeLog | ||
| 23 | @@ -1,3 +1,10 @@ | ||
| 24 | +2017-01-11 Even Rouault <even.rouault at spatialys.com> | ||
| 25 | + | ||
| 26 | + * tools/tiffcp.c: error out cleanly in cpContig2SeparateByRow and | ||
| 27 | + cpSeparate2ContigByRow if BitsPerSample != 8 to avoid heap based overflow. | ||
| 28 | + Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2656 and | ||
| 29 | + http://bugzilla.maptools.org/show_bug.cgi?id=2657 | ||
| 30 | + | ||
| 31 | 2016-11-19 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> | ||
| 32 | |||
| 33 | * libtiff 4.0.7 released. | ||
| 34 | diff --git a/tools/tiffcp.c b/tools/tiffcp.c | ||
| 35 | index 338a3d1..2e84577 100644 | ||
| 36 | --- a/tools/tiffcp.c | ||
| 37 | +++ b/tools/tiffcp.c | ||
| 38 | @@ -592,7 +592,7 @@ static copyFunc pickCopyFunc(TIFF*, TIFF*, uint16, uint16); | ||
| 39 | static int | ||
| 40 | tiffcp(TIFF* in, TIFF* out) | ||
| 41 | { | ||
| 42 | - uint16 bitspersample, samplesperpixel = 1; | ||
| 43 | + uint16 bitspersample = 1, samplesperpixel = 1; | ||
| 44 | uint16 input_compression, input_photometric = PHOTOMETRIC_MINISBLACK; | ||
| 45 | copyFunc cf; | ||
| 46 | uint32 width, length; | ||
| 47 | @@ -1068,6 +1068,16 @@ DECLAREcpFunc(cpContig2SeparateByRow) | ||
| 48 | register uint32 n; | ||
| 49 | uint32 row; | ||
| 50 | tsample_t s; | ||
| 51 | + uint16 bps = 0; | ||
| 52 | + | ||
| 53 | + (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps); | ||
| 54 | + if( bps != 8 ) | ||
| 55 | + { | ||
| 56 | + TIFFError(TIFFFileName(in), | ||
| 57 | + "Error, can only handle BitsPerSample=8 in %s", | ||
| 58 | + "cpContig2SeparateByRow"); | ||
| 59 | + return 0; | ||
| 60 | + } | ||
| 61 | |||
| 62 | inbuf = _TIFFmalloc(scanlinesizein); | ||
| 63 | outbuf = _TIFFmalloc(scanlinesizeout); | ||
| 64 | @@ -1121,6 +1131,16 @@ DECLAREcpFunc(cpSeparate2ContigByRow) | ||
| 65 | register uint32 n; | ||
| 66 | uint32 row; | ||
| 67 | tsample_t s; | ||
| 68 | + uint16 bps = 0; | ||
| 69 | + | ||
| 70 | + (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps); | ||
| 71 | + if( bps != 8 ) | ||
| 72 | + { | ||
| 73 | + TIFFError(TIFFFileName(in), | ||
| 74 | + "Error, can only handle BitsPerSample=8 in %s", | ||
| 75 | + "cpSeparate2ContigByRow"); | ||
| 76 | + return 0; | ||
| 77 | + } | ||
| 78 | |||
| 79 | inbuf = _TIFFmalloc(scanlinesizein); | ||
| 80 | outbuf = _TIFFmalloc(scanlinesizeout); | ||
| 81 | @@ -1763,7 +1783,7 @@ pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel) | ||
| 82 | uint32 w, l, tw, tl; | ||
| 83 | int bychunk; | ||
| 84 | |||
| 85 | - (void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv); | ||
| 86 | + (void) TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &shortv); | ||
| 87 | if (shortv != config && bitspersample != 8 && samplesperpixel > 1) { | ||
| 88 | fprintf(stderr, | ||
| 89 | "%s: Cannot handle different planar configuration w/ bits/sample != 8\n", | ||
| 90 | -- | ||
| 91 | 1.9.1 | ||
| 92 | |||
diff --git a/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb b/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb index 729678208f..e58173604e 100644 --- a/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb +++ b/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb | |||
| @@ -6,6 +6,7 @@ CVE_PRODUCT = "libtiff" | |||
| 6 | 6 | ||
| 7 | SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \ | 7 | SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \ |
| 8 | file://libtool2.patch \ | 8 | file://libtool2.patch \ |
| 9 | file://libtiff-CVE-2017-5225.patch \ | ||
| 9 | " | 10 | " |
| 10 | 11 | ||
| 11 | SRC_URI[md5sum] = "77ae928d2c6b7fb46a21c3a29325157b" | 12 | SRC_URI[md5sum] = "77ae928d2c6b7fb46a21c3a29325157b" |
