summaryrefslogtreecommitdiff
path: root/graphics/tiff/files/patch-tif_next.c
blob: e02f075eacd2d97ddaa567c53932714f8260a968 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
CVE-2006-3462
===================================================================
--- libtiff/tif_next.c.orig	2008-08-17 13:03:48.978994352 -0400
+++ libtiff/tif_next.c	2008-08-17 13:03:52.894064968 -0400
@@ -105,11 +105,16 @@
 			 * as codes of the form <color><npixels>
 			 * until we've filled the scanline.
 			 */
+			/*
+			 * Ensure the run does not exceed the scanline
+			 * bounds, potentially resulting in a security issue.
+			 * -- taviso@google.com 14 Jun 2006.
+			 */
 			op = row;
 			for (;;) {
 				grey = (n>>6) & 0x3;
 				n &= 0x3f;
-				while (n-- > 0)
+				while (n-- > 0 && npixels < imagewidth)
 					SETPIXEL(op, grey);
 				if (npixels >= (int) imagewidth)
 					break;