com php-src: Add check in fgetcsv in case sizeof(unit) != sizeof(size_t): ext/standard/file.c

From: Date: Mon, 12 Sep 2016 16:59:38 +0000
Subject: com php-src: Add check in fgetcsv in case sizeof(unit) != sizeof(size_t): ext/standard/file.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94457@lists.php.net to get a copy of this message
Commit: 8cceb012a7aabf3c36ab7c2724a436f976cdd165 Author: Anatol Belski <ab@php.net> Mon, 12 Sep 2016 18:59:38 +0200 Parents: 9528ce73156e2b6a5e96e371068b24a5975f4bcd Branches: PHP-7.0.11 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8cceb012a7aabf3c36ab7c2724a436f976cdd165 Log: Add check in fgetcsv in case sizeof(unit) != sizeof(size_t) (cherry picked from commit 99ac11222cb2a4e9aa6a865f908b28def349c049) Conflicts: ext/standard/file.c Changed paths: M ext/standard/file.c Diff: diff --git a/ext/standard/file.c b/ext/standard/file.c index 5b05177..6e17dc5 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -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);

« previous php.cvs (#94457) next »