Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ext/uri/tests/rfc3986/general/GHSA-mg3p-mxj9-g2mm-1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ all
memory_limit=-1
--FILE--
<?php
$uri = new Uri\Rfc3986\Uri("a://b/" . str_repeat("x", 2147483647 - 6));
// Parsing a single relative path segment is cheap under sanitizers.
$uri = new Uri\Rfc3986\Uri(str_repeat("x", 2147483647));

try {
$uri->toRawString();
Expand Down
3 changes: 2 additions & 1 deletion ext/uri/tests/rfc3986/general/GHSA-mg3p-mxj9-g2mm-2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ all
memory_limit=-1
--FILE--
<?php
$uri = new Uri\Rfc3986\Uri("a://b/" . str_repeat("x", 2147483648 - 6));
// Keep the length of each path segment below the 32-bit INT_MAX that uriparser uses while the recomposed path exceeds it.
$uri = new Uri\Rfc3986\Uri(str_repeat("x", 2147483648 - 2) . "/x");

try {
$uri->toRawString();
Expand Down
11 changes: 6 additions & 5 deletions ext/uri/tests/rfc3986/general/GHSA-mg3p-mxj9-g2mm-3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ all
memory_limit=-1
--FILE--
<?php
$uri = new Uri\Rfc3986\Uri("a://b/" . str_repeat("x", 2147483646 - 6));

$string = $uri->toRawString();
$length = 2147483646; // 32-bit INT_MAX - 1

// Parsing a single relative path segment is cheap under sanitizers.
$string = (new Uri\Rfc3986\Uri(str_repeat("x", $length)))->toRawString();

var_dump(strlen($string));
var_dump(substr($string, 0, 8));
var_dump(strspn($string, "x", 6) === 2147483646 - 6);
var_dump($string === str_repeat("x", $length));
?>
--EXPECT--
int(2147483646)
string(8) "a://b/xx"
bool(true)
Loading