Lucio Andrés Illanes Albornoz daac7c
From 98ed6179dec22db48f6e235d8ca9e2708bf4e71a Mon Sep 17 00:00:00 2001
Lucio Andrés Illanes Albornoz daac7c
From: Even Rouault <even.rouault@spatialys.com>
Lucio Andrés Illanes Albornoz daac7c
Date: Sat, 12 May 2018 14:24:15 +0200
Lucio Andrés Illanes Albornoz daac7c
Subject: [PATCH 4/4] TIFFWriteDirectorySec: avoid assertion. Fixes
Lucio Andrés Illanes Albornoz daac7c
 http://bugzilla.maptools.org/show_bug.cgi?id=2795. CVE-2018-10963
Lucio Andrés Illanes Albornoz daac7c
Lucio Andrés Illanes Albornoz daac7c
---
Lucio Andrés Illanes Albornoz daac7c
 libtiff/tif_dirwrite.c | 7 +++++--
Lucio Andrés Illanes Albornoz daac7c
 1 file changed, 5 insertions(+), 2 deletions(-)
Lucio Andrés Illanes Albornoz daac7c
Lucio Andrés Illanes Albornoz daac7c
diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c
Lucio Andrés Illanes Albornoz daac7c
index c68d6d2..5d0a669 100644
Lucio Andrés Illanes Albornoz daac7c
--- a/libtiff/tif_dirwrite.c
Lucio Andrés Illanes Albornoz daac7c
+++ b/libtiff/tif_dirwrite.c
Lucio Andrés Illanes Albornoz daac7c
@@ -697,8 +697,11 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
Lucio Andrés Illanes Albornoz daac7c
 								}
Lucio Andrés Illanes Albornoz daac7c
 								break;
Lucio Andrés Illanes Albornoz daac7c
 							default:
Lucio Andrés Illanes Albornoz daac7c
-								assert(0);   /* we should never get here */
Lucio Andrés Illanes Albornoz daac7c
-								break;
Lucio Andrés Illanes Albornoz daac7c
+								TIFFErrorExt(tif->tif_clientdata,module,
Lucio Andrés Illanes Albornoz daac7c
+								            "Cannot write tag %d (%s)",
Lucio Andrés Illanes Albornoz daac7c
+								            TIFFFieldTag(o),
Lucio Andrés Illanes Albornoz daac7c
+                                                                            o->field_name ? o->field_name : "unknown");
Lucio Andrés Illanes Albornoz daac7c
+								goto bad;
Lucio Andrés Illanes Albornoz daac7c
 						}
Lucio Andrés Illanes Albornoz daac7c
 					}
Lucio Andrés Illanes Albornoz daac7c
 				}
Lucio Andrés Illanes Albornoz daac7c
-- 
Lucio Andrés Illanes Albornoz daac7c
2.17.0
Lucio Andrés Illanes Albornoz daac7c