diff options
| author | Derick Rethans <derick@php.net> | 2005-02-18 13:37:23 +0000 |
|---|---|---|
| committer | Derick Rethans <derick@php.net> | 2005-02-18 13:37:23 +0000 |
| commit | ff1687731dee44ec58113b08ac0e1004e05fad35 (patch) | |
| tree | f1e337736e7ab195a06e61ee0be3e9095a45cea1 | |
| parent | b1157ff8d9d1db883a658c9883b6c02a183f3fd6 (diff) | |
| download | php-git-ff1687731dee44ec58113b08ac0e1004e05fad35.tar.gz | |
- Fixed bug #32021: Crash caused by range('', 'z')
| -rw-r--r-- | ext/standard/array.c | 2 | ||||
| -rw-r--r-- | ext/standard/tests/array/bug32021.phpt | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 270ba0dc50..9848de248d 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1590,7 +1590,7 @@ PHP_FUNCTION(range) array_init(return_value); /* If the range is given as strings, generate an array of characters. */ - if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING) { + if (Z_TYPE_P(zlow) == IS_STRING && Z_TYPE_P(zhigh) == IS_STRING && Z_STRLEN_P(zlow) >= 1 && Z_STRLEN_P(zhigh) >= 1) { int type1, type2; unsigned char *low, *high; long lstep = (long) step; diff --git a/ext/standard/tests/array/bug32021.phpt b/ext/standard/tests/array/bug32021.phpt new file mode 100644 index 0000000000..5d3b421ab4 --- /dev/null +++ b/ext/standard/tests/array/bug32021.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #32021 (Crash caused by range('', 'z')) +--FILE-- +<?php +$foo = range('', 'z'); +var_dump($foo); +?> +ALIVE +--EXPECT-- +array(1) { + [0]=> + int(0) +} +ALIVE |
