mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +02:00
Fix bad args to grapheme_extract(), reported by Maksymilian Arciemowicz
This commit is contained in:
parent
e1dee992ee
commit
c28cac404d
1 changed files with 10 additions and 4 deletions
|
@ -799,7 +799,7 @@ PHP_FUNCTION(grapheme_extract)
|
||||||
|
|
||||||
if ( NULL != next ) {
|
if ( NULL != next ) {
|
||||||
if ( !PZVAL_IS_REF(next) ) {
|
if ( !PZVAL_IS_REF(next) ) {
|
||||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||||
"grapheme_extract: 'next' was not passed by reference", 0 TSRMLS_CC );
|
"grapheme_extract: 'next' was not passed by reference", 0 TSRMLS_CC );
|
||||||
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
@ -819,12 +819,18 @@ PHP_FUNCTION(grapheme_extract)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( lstart > INT32_MAX || lstart < 0 || lstart >= str_len ) {
|
if ( lstart > INT32_MAX || lstart < 0 || lstart >= str_len ) {
|
||||||
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_extract: start not contained in string", 0 TSRMLS_CC );
|
||||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_extract: start not contained in string", 1 TSRMLS_CC );
|
|
||||||
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( size > INT32_MAX || size < 0) {
|
||||||
|
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_extract: size is invalid", 0 TSRMLS_CC );
|
||||||
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
|
if (size == 0) {
|
||||||
|
RETURN_EMPTY_STRING();
|
||||||
|
}
|
||||||
|
|
||||||
/* we checked that it will fit: */
|
/* we checked that it will fit: */
|
||||||
start = (int32_t) lstart;
|
start = (int32_t) lstart;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue