libtiff: * libtiff/tif_read.c (TIFFReadBufferSetup): Skip allocating

https://github.com/libsdl-org/libtiff/commit/a0193c5d40b75bc0217b4af9a28649fba91750c5

From a0193c5d40b75bc0217b4af9a28649fba91750c5 Mon Sep 17 00:00:00 2001
From: Bob Friesenhahn <[EMAIL REDACTED]>
Date: Wed, 9 Jun 2010 14:32:47 +0000
Subject: [PATCH] * libtiff/tif_read.c (TIFFReadBufferSetup): Skip allocating
 tif_rawdata if tif_rawdatasize becomes zero.

---
 ChangeLog          | 5 +++++
 libtiff/tif_read.c | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b085ae17..6b280e5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-09  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* libtiff/tif_read.c (TIFFReadBufferSetup): Skip allocating
+	tif_rawdata if tif_rawdatasize becomes zero.
+
 2010-06-08  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
 
 	* tools/tiffcrop.c: Removed duplicated macros such as
diff --git a/libtiff/tif_read.c b/libtiff/tif_read.c
index a64fc3b0..8ac0ae66 100644
--- a/libtiff/tif_read.c
+++ b/libtiff/tif_read.c
@@ -1,4 +1,4 @@
-/* $Id: tif_read.c,v 1.16.2.2 2010-06-08 23:29:51 bfriesen Exp $ */
+/* $Id: tif_read.c,v 1.16.2.3 2010-06-09 14:32:47 bfriesen Exp $ */
 
 /*
  * Copyright (c) 1988-1997 Sam Leffler
@@ -607,7 +607,8 @@ TIFFReadBufferSetup(TIFF* tif, tdata_t bp, tsize_t size)
 		tif->tif_flags &= ~TIFF_MYBUFFER;
 	} else {
 		tif->tif_rawdatasize = TIFFroundup(size, 1024);
-		tif->tif_rawdata = (tidata_t) _TIFFmalloc(tif->tif_rawdatasize);
+		if (tif->tif_rawdatasize > 0)
+			tif->tif_rawdata = (tidata_t) _TIFFmalloc(tif->tif_rawdatasize);
 		tif->tif_flags |= TIFF_MYBUFFER;
 	}
 	if ((tif->tif_rawdata == NULL) || (tif->tif_rawdatasize == 0)) {