-
Notifications
You must be signed in to change notification settings - Fork 8k
Expand file tree
/
Copy pathsec_embedded_null_truncation.phpt
More file actions
59 lines (57 loc) · 1.78 KB
/
sec_embedded_null_truncation.phpt
File metadata and controls
59 lines (57 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--TEST--
bcmath strings with embedded null bytes must be rejected as not well-formed
--EXTENSIONS--
bcmath
--FILE--
<?php
$cases = [
"100\x005",
"1.2\x003",
"\x00123",
];
$calls = [
fn($s) => bcadd($s, "0"),
fn($s) => bcsub($s, "0"),
fn($s) => bcmul($s, "1"),
fn($s) => bcdiv($s, "1"),
fn($s) => bcmod($s, "7"),
fn($s) => bcpow($s, "1"),
fn($s) => bccomp($s, "0"),
fn($s) => bcsqrt($s),
];
foreach ($cases as $s) {
foreach ($calls as $fn) {
try {
$fn($s);
echo "FAIL: accepted\n";
} catch (\ValueError $e) {
echo $e->getMessage() . "\n";
}
}
}
?>
--EXPECT--
bcadd(): Argument #1 ($num1) is not well-formed
bcsub(): Argument #1 ($num1) is not well-formed
bcmul(): Argument #1 ($num1) is not well-formed
bcdiv(): Argument #1 ($num1) is not well-formed
bcmod(): Argument #1 ($num1) is not well-formed
bcpow(): Argument #1 ($num) is not well-formed
bccomp(): Argument #1 ($num1) is not well-formed
bcsqrt(): Argument #1 ($num) is not well-formed
bcadd(): Argument #1 ($num1) is not well-formed
bcsub(): Argument #1 ($num1) is not well-formed
bcmul(): Argument #1 ($num1) is not well-formed
bcdiv(): Argument #1 ($num1) is not well-formed
bcmod(): Argument #1 ($num1) is not well-formed
bcpow(): Argument #1 ($num) is not well-formed
bccomp(): Argument #1 ($num1) is not well-formed
bcsqrt(): Argument #1 ($num) is not well-formed
bcadd(): Argument #1 ($num1) is not well-formed
bcsub(): Argument #1 ($num1) is not well-formed
bcmul(): Argument #1 ($num1) is not well-formed
bcdiv(): Argument #1 ($num1) is not well-formed
bcmod(): Argument #1 ($num1) is not well-formed
bcpow(): Argument #1 ($num) is not well-formed
bccomp(): Argument #1 ($num1) is not well-formed
bcsqrt(): Argument #1 ($num) is not well-formed