Skip to content

Commit 564fbfd

Browse files
committed
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5: Add regression test for GH-16821 (#24228)
2 parents 70e083c + 03d8c43 commit 564fbfd

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

‎ext/opcache/tests/jit/gh16821.phpt‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
--TEST--
2+
GH-16821 (Spill conflict between ASSIGN.op1_def and ASSIGN.op2_use)
3+
--EXTENSIONS--
4+
opcache
5+
--INI--
6+
opcache.enable=1
7+
opcache.enable_cli=1
8+
opcache.jit=tracing
9+
opcache.jit_buffer_size=64M
10+
opcache.jit_hot_loop=1
11+
opcache.jit_hot_func=1
12+
opcache.jit_hot_return=1
13+
opcache.jit_hot_side_exit=1
14+
--FILE--
15+
<?php
16+
namespace Foo; // Needed so ord() and strlen() don't compile to opcodes
17+
18+
// This code is heavily derived from phpseclib
19+
// License:
20+
// Copyright (c) 2011-2019 TerraFrost and other contributors
21+
//
22+
// Permission is hereby granted, free of charge, to any person obtaining
23+
// a copy of this software and associated documentation files (the
24+
// "Software"), to deal in the Software without restriction, including
25+
// without limitation the rights to use, copy, modify, merge, publish,
26+
// distribute, sublicense, and/or sell copies of the Software, and to
27+
// permit persons to whom the Software is furnished to do so, subject to
28+
// the following conditions:
29+
//
30+
// The above copyright notice and this permission notice shall be
31+
// included in all copies or substantial portions of the Software.
32+
//
33+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
35+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
37+
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
38+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
39+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40+
41+
function reduce(string $c, string $u): string {
42+
$c = str_pad($c, 143, "\0", STR_PAD_LEFT);
43+
for ($h = 5, $i = 1140; $i >= 571;) {
44+
$g = $h >> 3;
45+
for ($mask = 0x80; $mask > 0; $mask >>= 1, $i--, $h++) {
46+
if (ord($c[$g]) & $mask) {
47+
$temp = $i - 571;
48+
$j = $temp >> 3;
49+
$t1 = $j ? substr($c, 0, -$j) : $c;
50+
$length = strlen($t1);
51+
$temp = $t1 ^ str_pad($u, $length, "\0", STR_PAD_LEFT);
52+
$c = substr_replace($c, $temp, 0, $length);
53+
}
54+
}
55+
}
56+
return $c;
57+
}
58+
59+
var_dump(md5(reduce(str_repeat("\xff", 72), "\x04\x25")));
60+
?>
61+
--EXPECT--
62+
string(32) "dd12a5bb6e3d7b4abcdd92e135850169"
63+

0 commit comments

Comments
 (0)