1--TEST--
2GHSA-g665-fm4p-vhff (OOB access in ldap_escape)
3--EXTENSIONS--
4ldap
5--INI--
6memory_limit=-1
7--SKIPIF--
8<?php
9if (PHP_INT_SIZE !== 4) die("skip only for 32-bit");
10if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
11?>
12--FILE--
13<?php
14try {
15    ldap_escape(str_repeat("*", 1431655759), "", LDAP_ESCAPE_FILTER);
16} catch (ValueError $e) {
17    echo $e->getMessage(), "\n";
18}
19
20// would allocate a string of length 2
21try {
22    ldap_escape(str_repeat("*", 1431655766), "", LDAP_ESCAPE_FILTER);
23} catch (ValueError $e) {
24    echo $e->getMessage(), "\n";
25}
26?>
27--EXPECT--
28ldap_escape(): Argument #1 ($value) is too long
29ldap_escape(): Argument #1 ($value) is too long
30