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

Fix zero-extension on range() char parameters

This commit is contained in:
Niels Dossche
2025-11-11 00:01:38 +01:00
parent 9d9f979ca1
commit 5185d46ccc

View File

@@ -3049,9 +3049,9 @@ PHP_FUNCTION(range)
goto handle_numeric_inputs;
}
/* Generate array of characters, as ints to make bounds checking possible in the loop condition */
int low = Z_STRVAL_P(user_start)[0];
int high = Z_STRVAL_P(user_end)[0];
/* Generate array of characters, as zero-extended ints to make bounds checking possible in the loop condition */
int low = (unsigned char) Z_STRVAL_P(user_start)[0];
int high = (unsigned char) Z_STRVAL_P(user_end)[0];
/* Decreasing char range */
if (low > high) {