From d4de127dd8db255576ad8c8eeec27e8aef4132e5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 20 Jun 2019 14:09:18 +0200 Subject: [PATCH] In php_needle_char() use well-defined double->integer cast ...by going through zval_get_long(). Generally out of range double casts are undefined. --- ext/standard/string.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index a40a2c36ca..78b726c87f 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1814,8 +1814,6 @@ static int php_needle_char(zval *needle, char *target) *target = '\1'; return SUCCESS; case IS_DOUBLE: - *target = (char)(int)Z_DVAL_P(needle); - return SUCCESS; case IS_OBJECT: *target = (char) zval_get_long(needle); return SUCCESS; -- 2.50.1