1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3'

This commit is contained in:
Jakub Zelenka
2023-09-08 11:00:14 +01:00
2 changed files with 20 additions and 0 deletions

View File

@@ -2023,6 +2023,9 @@ PHPAPI HashTable *php_fgetcsv(php_stream *stream, char delimiter, char enclosure
if (bptr > limit) {
/* if the line ends with enclosure, we need to go back by
* one character so the \0 character is not copied. */
if (hunk_begin == bptr) {
--hunk_begin;
}
--bptr;
}
goto quit_loop_2;
@@ -2038,6 +2041,9 @@ PHPAPI HashTable *php_fgetcsv(php_stream *stream, char delimiter, char enclosure
if (bptr > limit) {
/* if the line ends with enclosure, we need to go back by
* one character so the \0 character is not copied. */
if (hunk_begin == bptr) {
--hunk_begin;
}
--bptr;
}
goto quit_loop_2;

View File

@@ -0,0 +1,14 @@
--TEST--
GH-12151 (str_getcsv ending with escape zero segfualt)
--FILE--
<?php
var_export(str_getcsv("y","","y","\000"));
var_export(str_getcsv("\0yy","y","y","\0"));
?>
--EXPECT--
array (
0 => '' . "\0" . '',
)array (
0 => '' . "\0" . '',
1 => '' . "\0" . '',
)