xref: /php-src/ext/dom/tests/gh16465.phpt (revision d70f3ba9)
1--TEST--
2GH-16465 (Heap buffer overflow in DOMNode->getElementByTagName)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$v10 = new DOMElement("a");
9try {
10    $v10->getElementsByTagName("text\0something");
11} catch (ValueError $e) {
12    echo $e->getMessage(), "\n";
13}
14try {
15    $v10->getElementsByTagNameNS("", "text\0something");
16} catch (ValueError $e) {
17    echo $e->getMessage(), "\n";
18}
19try {
20    $v10->getElementsByTagNameNS("text\0something", "");
21} catch (ValueError $e) {
22    echo $e->getMessage(), "\n";
23}
24
25?>
26--EXPECT--
27DOMElement::getElementsByTagName(): Argument #1 ($qualifiedName) must not contain any null bytes
28DOMElement::getElementsByTagNameNS(): Argument #2 ($localName) must not contain any null bytes
29DOMElement::getElementsByTagNameNS(): Argument #1 ($namespace) must not contain any null bytes
30