From 80d061b18fe29ec39f4b41f7682b247c5a50e3c7 Mon Sep 17 00:00:00 2001 From: Greg Beaver Date: Fri, 31 Jul 2009 23:44:52 +0000 Subject: [PATCH] fix segfault when running run-tests.php, and general potential for corruption by calling php_stream_path_encode for unicode strings, php_stream_path_param_encode decrements the refcount, but never restores it, which can cause freeing of zvals before they are done being used. --- main/php_streams.h | 1 + 1 file changed, 1 insertion(+) diff --git a/main/php_streams.h b/main/php_streams.h index a13c323620..472885a552 100755 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -422,6 +422,7 @@ static inline int _php_stream_path_param_encode(zval **ppzval, char **ppath, int if (FAILURE == php_stream_path_encode(NULL, &path, &path_len, Z_USTRVAL_PP(ppzval), Z_USTRLEN_PP(ppzval), options, context)) { return FAILURE; } + Z_ADDREF_PP(ppzval); /* the conversion removes a refcount */ MAKE_STD_ZVAL(zpath); ZVAL_STRINGL(zpath, path, path_len, 0); Z_UNSET_ISREF_P(zpath); -- 2.40.0