mirror of
https://github.com/php/php-src.git
synced 2024-12-11 10:54:47 +08:00
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:
parent
9528ce7315
commit
8cceb012a7
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user