From e1a4178de140986574bb58755a2e7ab3f0bc749b Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Thu, 25 Jan 2018 15:19:30 -0700 Subject: [PATCH] php7: redux of fix for issue #5488 Upstream was a little premature on asking for a change and not vetting it. Here is the currently proposed fix. Signed-off-by: Philip Prindeville --- lang/php7/Makefile | 2 +- ...2-php_iconv_string-null-out-pointer.patch} | 35 ++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) rename lang/php7/patches/{1012-php_iconv_string-null-out-pointer => 1012-php_iconv_string-null-out-pointer.patch} (51%) diff --git a/lang/php7/Makefile b/lang/php7/Makefile index f1f781fe4..8b6f6fb50 100644 --- a/lang/php7/Makefile +++ b/lang/php7/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=php PKG_VERSION:=7.2.1 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MAINTAINER:=Michael Heimpold diff --git a/lang/php7/patches/1012-php_iconv_string-null-out-pointer b/lang/php7/patches/1012-php_iconv_string-null-out-pointer.patch similarity index 51% rename from lang/php7/patches/1012-php_iconv_string-null-out-pointer rename to lang/php7/patches/1012-php_iconv_string-null-out-pointer.patch index 5f71b7d70..6dfbe51ef 100644 --- a/lang/php7/patches/1012-php_iconv_string-null-out-pointer +++ b/lang/php7/patches/1012-php_iconv_string-null-out-pointer.patch @@ -1,4 +1,4 @@ -commit 8b6882d95dfe9096a22052bbff0c134b10932d20 +commit 31e53f07c26e5ac75ec2c2d99497439323dbdaf7 Author: Philip Prindeville Date: Wed Jan 24 18:47:19 2018 -0700 @@ -8,7 +8,7 @@ Date: Wed Jan 24 18:47:19 2018 -0700 will always be NULL (and not require free()ing, obviously). diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c -index 35dafd4..bc7f3aa 100644 +index 35dafd4..4289242 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -559,6 +559,8 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, @@ -20,7 +20,34 @@ index 35dafd4..bc7f3aa 100644 /* This is not the right way to get output size... This is not space efficient for large text. -@@ -984,9 +986,6 @@ static php_iconv_err_t _php_iconv_strpos(size_t *pretval, + +commit 3763c8f1645983b5abc37c60597e1ecc1bf89019 +Author: Philip Prindeville +Date: Thu Jan 25 14:18:00 2018 -0700 + + Always free out_buf in php_iconv_string() + +diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c +index 4289242..807bb14 100644 +--- a/ext/iconv/iconv.c ++++ b/ext/iconv/iconv.c +@@ -697,6 +697,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, + iconv_close(cd); + + if (result == (size_t)(-1)) { ++ zend_string_free(out_buf); + switch (errno) { + case EINVAL: + retval = PHP_ICONV_ERR_ILLEGAL_CHAR; +@@ -713,7 +714,6 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, + + default: + /* other error */ +- zend_string_free(out_buf); + return PHP_ICONV_ERR_UNKNOWN; + } + } +@@ -986,9 +986,6 @@ static php_iconv_err_t _php_iconv_strpos(size_t *pretval, err = php_iconv_string(ndl, ndl_nbytes, &ndl_buf, GENERIC_SUPERSET_NAME, enc); if (err != PHP_ICONV_ERR_SUCCESS) { @@ -30,7 +57,7 @@ index 35dafd4..bc7f3aa 100644 return err; } -@@ -2463,9 +2462,6 @@ PHP_NAMED_FUNCTION(php_if_iconv) +@@ -2465,9 +2462,6 @@ PHP_NAMED_FUNCTION(php_if_iconv) if (err == PHP_ICONV_ERR_SUCCESS && out_buffer != NULL) { RETVAL_STR(out_buffer); } else {