php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #80366
Patch iptc_fix.patch revision 2020-11-13 19:32 UTC by sagpant at microsoft dot com
Patch iptc.patch revision 2020-11-13 19:12 UTC by sagpant at microsoft dot com

Patch iptc.patch for GetImageSize related Bug #80366

Patch version 2020-11-13 19:12 UTC

Return to Bug #80366 | Download this patch
Patch Revisions:

Developer: sagpant@microsoft.com

diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
index f3c17dadd9..9b5a583f6a 100644
--- a/ext/standard/iptc.c
+++ b/ext/standard/iptc.c
@@ -217,11 +217,11 @@ PHP_FUNCTION(iptcembed)
 	}
 
 	if (spool < 2) {
-		zend_fstat(fileno(fp), &sb);
-
-		spoolbuf = zend_string_safe_alloc(1, iptcdata_len + sizeof(psheader) + 1024 + 1, sb.st_size, 0);
-		poi = (unsigned char*)ZSTR_VAL(spoolbuf);
-		memset(poi, 0, iptcdata_len + sizeof(psheader) + sb.st_size + 1024 + 1);
+		if (zend_fstat(fileno(fp), &sb) != -1) {
+			spoolbuf = zend_string_safe_alloc(1, iptcdata_len + sizeof(psheader) + 1024 + 1, sb.st_size, 0);
+			poi = (unsigned char*)ZSTR_VAL(spoolbuf);
+			memset(poi, 0, iptcdata_len + sizeof(psheader) + sb.st_size + 1024 + 1);
+		}
 	}
 
 	if (php_iptc_get1(fp, spool, poi?&poi:0) != 0xFF) {
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Aug 12 18:05:45 2022 UTC