From 091b7642c2d8a087d3cbcba681369abfb964330d Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sun, 11 May 2014 18:44:14 -0700 Subject: [PATCH 1/2] Fix bug #67249: printf out-of-bounds read --- ext/standard/formatted_print.c | 6 ++++-- ext/standard/tests/strings/bug67249.phpt | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 ext/standard/tests/strings/bug67249.phpt diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 3cd5839313d..2592b1655dc 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -376,6 +376,7 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC int alignment, currarg, adjusting, argnum, width, precision; char *format, *result, padding; int always_sign; + int format_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { return NULL; @@ -414,11 +415,12 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC convert_to_string_ex(args[format_offset]); format = Z_STRVAL_PP(args[format_offset]); + format_len = Z_STRLEN_PP(args[format_offset]); result = emalloc(size); currarg = 1; - while (inpos +--EXPECT-- +string(0) "" From 76b06780d5bd3b654bda98d2403994cf08b5143d Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 27 May 2014 11:26:24 -0700 Subject: [PATCH 2/2] update NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 3643227385d..8b5acf310a1 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ PHP NEWS . Fixed bug #67245 (usage of memcpy() with overlapping src and dst in zend_exceptions.c). (Bob) . Fixed bug #67247 (spl_fixedarray_resize integer overflow). (Stas) + . Fixed bug #67249 (printf out-of-bounds read). (Stas) . Fixed bug #67250 (iptcparse out-of-bounds read). (Stas) . Fixed bug #67252 (convert_uudecode out-of-bounds read). (Stas) @@ -31,6 +32,7 @@ PHP NEWS not only the subset). (Anatol) - Fileinfo: + . Fixed bug #66307 (Fileinfo crashes with powerpoint files). (Anatol) . Fixed bug #67327 (fileinfo: CDF infinite loop in nelements DoS). . Fixed bug #67328 (fileinfo: fileinfo: numerous file_printf calls resulting in performance degradation).