File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -1507,18 +1507,19 @@ PHP_FUNCTION(xml_parser_set_option)
1507
1507
parser -> parsehuge = zend_is_true (value );
1508
1508
break ;
1509
1509
/* Integer option */
1510
- case PHP_XML_OPTION_SKIP_TAGSTART :
1510
+ case PHP_XML_OPTION_SKIP_TAGSTART : {
1511
1511
/* The tag start offset is stored in an int */
1512
1512
/* TODO Improve handling of values? */
1513
- parser -> toffset = zval_get_long (value );
1514
- if (parser -> toffset < 0 ) {
1513
+ zend_long value_long = zval_get_long (value );
1514
+ if (value_long < 0 || value_long > INT_MAX ) {
1515
1515
/* TODO Promote to ValueError in PHP 9.0 */
1516
1516
php_error_docref (NULL , E_WARNING , "Argument #3 ($value) must be between 0 and %d"
1517
- " for option XML_OPTION_SKIP_TAGSTART" , INT_MAX );
1518
- parser -> toffset = 0 ;
1517
+ " for option XML_OPTION_SKIP_TAGSTART" , INT_MAX );
1519
1518
RETURN_FALSE ;
1520
1519
}
1520
+ parser -> toffset = (int ) value_long ;
1521
1521
break ;
1522
+ }
1522
1523
/* String option */
1523
1524
case PHP_XML_OPTION_TARGET_ENCODING : {
1524
1525
const xml_encoding * enc ;
You can’t perform that action at this time.
0 commit comments