php-src/ext/xml/tests
Christoph M. Becker 0af3f49312 Fix #79922: Crash after multiple calls to xml_parser_free()
We must not call `zend_list_delete()` in resource closer functions
exposed to userland, because decreasing the refcount there leads to
use-after-free scenarios.  In this case, commit 4a42fbb worked for
typical use-cases where `xml_parser_free()` has been called exactly
once for the resource, because there is an internal zval (`->index`)
referencing the same resource which already increased the refcount by
one.  However, when `xml_parser_free()` is called multiple times on the
same XML parser resource, the resource would be freed prematurely.

Instead we forcefully close the resource in `xml_parser_free()`.  We
also could decrease the refcount of the resource there, but that would
require to call `xml_parser_free()` which is somewhat uncommon, and
would be particularly bad wrt. PHP 8 where that function is a NOP, and
as such doesn't have to be called.  So we do no longer increase the
refcount of the resource when copying it to the internal zval, and let
the usualy refcounting semantics take care of the resource destruction.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=4a42fbbbc73aad7427aef5c89974d1833636e082>
2020-08-10 12:23:44 +02:00
..
bug25666.phpt
bug26528.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
bug26614_libxml.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
bug26614.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
bug27908.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
bug30266.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
bug30875.phpt Fix #30875: xml_parse_into_struct() does not resolve entities 2018-10-09 16:04:43 +02:00
bug32001.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
bug32001b.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
bug35447.phpt
bug46699.phpt MFH: fix bug #46699: (xml_parse crash when parser is namespace aware) 2008-12-12 04:16:21 +00:00
bug50576.phpt Use EXPECT instead of EXPECTF when possible 2018-02-20 21:53:48 +01:00
bug65236.phpt add test for bug #65236 2013-07-10 19:35:18 +02:00
bug71592.phpt Fix and improve test case 2018-10-30 18:53:03 +01:00
bug72085.phpt Merge branch 'PHP-5.6' into PHP-7.0 2016-08-17 01:22:11 +02:00
bug72099.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
bug72714.phpt Improvements to fix #72714, suggested by nikic 2016-08-20 12:44:20 +02:00
bug73135.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:31:31 +02:00
bug79922.phpt Fix #79922: Crash after multiple calls to xml_parser_free() 2020-08-10 12:23:44 +02:00
inc.ent
skipif.inc
xml001.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
xml002.phpt Deprecate each() 2017-02-03 21:02:52 +01:00
xml003.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
xml004.phpt Deprecate each() 2017-02-03 21:02:52 +01:00
xml007.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
xml009.phpt
xml010.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
xml011.phpt
xml_closures_001.phpt Deprecate each() 2017-02-03 21:02:52 +01:00
xml_error_string_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_error_string_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_get_current_byte_index_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_get_current_byte_index_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_get_current_column_number_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_get_current_column_number_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_get_current_line_number_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_get_current_line_number_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_get_error_code_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_get_error_code_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parse_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parse_into_struct_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parse_into_struct_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parse_into_struct_variation.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parse_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_create_error.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
xml_parser_create_ns_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_create_ns_variation1.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
xml_parser_create_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_free_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_free_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_get_option_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_get_option_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_get_option_variation2.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_get_option_variation3.phpt Add support for getting SKIP_TAGSTART and SKIP_WHITE options 2018-10-16 18:47:31 +02:00
xml_parser_set_option_basic.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
xml_parser_set_option_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_set_option_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_set_option_variation2.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_parser_set_option_variation3.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
xml_set_character_data_handler_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_character_data_handler_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_default_handler_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_default_handler_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_element_handler_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_element_handler_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_end_namespace_decl_handler_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_end_namespace_decl_handler_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_external_entity_ref_handler_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_external_entity_ref_handler_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_notation_decl_handler_basic.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
xml_set_notation_decl_handler_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_notation_decl_handler_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_object_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_object_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_object_variation2.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_processing_instruction_handler_basic.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_processing_instruction_handler_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_processing_instruction_handler_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_start_namespace_decl_handler_basic.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_start_namespace_decl_handler_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_start_namespace_decl_handler_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_unparsed_entity_decl_handler_error.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xml_set_unparsed_entity_decl_handler_variation1.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:32:30 +02:00
xmltest.xml