tiff: Security fix CVE-2016-9540

tools/tiffcp.c in libtiff 4.0.6 has an out-of-bounds write on tiled
images with odd tile width versus image width. Reported as MSVR 35103,
aka "cpStripToTile heap-buffer-overflow."

External References:
https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-9540

Patch from:
5ad9d8016f

(From OE-Core rev: cc97dc66006c7892473e3b4790d05e12445bb927)

(From OE-Core rev: ad2c4710ef15c35f6dd4e7642efbceb2cbf81736)

(From OE-Core rev: 6f58c18016258c0a49b4d0ef50d170a1bbb671f4)

Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Zhixiong Chi 2016-11-28 16:12:04 +08:00 committed by Richard Purdie
parent 3c61ee2f68
commit 98e368e4b6
2 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,60 @@
From 5ad9d8016fbb60109302d558f7edb2cb2a3bb8e3 Mon Sep 17 00:00:00 2001
From: erouault <erouault>
Date: Sat, 8 Oct 2016 15:54:56 +0000
Subject: [PATCH] fix CVE-2016-9540
* tools/tiffcp.c: fix out-of-bounds write on tiled images with odd
tile width vs image width. Reported as MSVR 35103
by Axel Souchet and Vishal Chauhan from the MSRC Vulnerabilities &
Mitigations team.
CVE: CVE-2016-9540
Upstream-Status: Backport
https://github.com/vadz/libtiff/commit/5ad9d8016fbb60109302d558f7edb2cb2a3bb8e3
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
---
ChangeLog | 7 +++++++
tools/tiffcp.c | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
Index: tiff-4.0.4/ChangeLog
===================================================================
--- tiff-4.0.4.orig/ChangeLog 2016-11-24 14:40:43.046867737 +0800
+++ tiff-4.0.4/ChangeLog 2016-11-28 14:38:01.681276171 +0800
@@ -17,6 +17,13 @@
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2500
(CVE-2014-8127, duplicate: CVE-2016-3658)
+2016-10-08 Even Rouault <even.rouault at spatialys.com>
+
+ * tools/tiffcp.c: fix out-of-bounds write on tiled images with odd
+ tile width vs image width. Reported as MSVR 35103
+ by Axel Souchet and Vishal Chauhan from the MSRC Vulnerabilities &
+ Mitigations team.
+
2016-09-24 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
* libtiff/tif_getimage.c (TIFFRGBAImageOK): Reject attempts to
Index: tiff-4.0.4/tools/tiffcp.c
===================================================================
--- tiff-4.0.4.orig/tools/tiffcp.c 2015-06-21 09:09:10.000000000 +0800
+++ tiff-4.0.4/tools/tiffcp.c 2016-11-28 14:41:02.221277430 +0800
@@ -1338,7 +1338,7 @@
uint32 colb = 0;
uint32 col;
- for (col = 0; col < imagewidth; col += tw) {
+ for (col = 0; col < imagewidth && colb < imagew; col += tw) {
if (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0
&& !ignore) {
TIFFError(TIFFFileName(in),
@@ -1523,7 +1523,7 @@
uint32 colb = 0;
uint32 col;
- for (col = 0; col < imagewidth; col += tw) {
+ for (col = 0; col < imagewidth && colb < imagew; col += tw) {
/*
* Tile is clipped horizontally. Calculate
* visible portion and skewing factors.

View File

@ -17,6 +17,7 @@ SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
file://CVE-2016-3622.patch \
file://CVE-2016-3658.patch \
file://CVE-2016-3632.patch \
file://CVE-2016-9540.patch \
"
SRC_URI[md5sum] = "d1d2e940dea0b5ad435f21f03d96dd72"