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)
15071507 parser -> parsehuge = zend_is_true (value );
15081508 break ;
15091509 /* Integer option */
1510- case PHP_XML_OPTION_SKIP_TAGSTART :
1510+ case PHP_XML_OPTION_SKIP_TAGSTART : {
15111511 /* The tag start offset is stored in an int */
15121512 /* 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 ) {
15151515 /* TODO Promote to ValueError in PHP 9.0 */
15161516 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 );
15191518 RETURN_FALSE ;
15201519 }
1520+ parser -> toffset = (int ) value_long ;
15211521 break ;
1522+ }
15221523 /* String option */
15231524 case PHP_XML_OPTION_TARGET_ENCODING : {
15241525 const xml_encoding * enc ;
You can’t perform that action at this time.
0 commit comments