Add check in fgetcsv in case sizeof(unit) != sizeof(size_t)

(cherry picked from commit 99ac11222cb2a4e9aa6a865f908b28def349c049)

Conflicts:
	ext/standard/file.c
This commit is contained in:
Anatol Belski 2016-09-12 18:59:38 +02:00
parent 9528ce7315
commit 8cceb012a7

View File

@ -2336,6 +2336,12 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char
/* 3. Now pass our field back to php */
*comp_end = '\0';
#ifndef ZEND_ENABLE_ZVAL_LONG64
if (UNEXPECTED((comp_end - temp) > ZEND_LONG_MAX)) {
zend_error_noreturn(E_WARNING, "String overflow, max size is " ZEND_LONG_FMT, ZEND_LONG_MAX);
break;
}
#endif
add_next_index_stringl(return_value, temp, comp_end - temp);
} while (inc_len > 0);