xref: /PHP-8.1/ext/gd/tests/bug71912-mb.phpt (revision 0aaad46c)
1--TEST--
2Bug #71912 (libgd: signedness vulnerability)
3--EXTENSIONS--
4gd
5--SKIPIF--
6<?php
7        if (!GD_BUNDLED) {
8            if (version_compare(GD_VERSION, '2.2.0', '<')) {
9                die("skip test requires GD 2.2.0 or higher");
10            }
11            if (version_compare(GD_VERSION, '2.3.3', '>=')) {
12                die("skip test requires GD 2.3.2 or older");
13            }
14        }
15        if(!function_exists('imagecreatefromgd2')) die('skip imagecreatefromgd2() not available');
16?>
17--FILE--
18<?php
19imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . "invalid_neg_size私はガラスを食べられます.gd2");
20?>
21OK
22--EXPECTF--
23Warning: imagecreatefromgd2(): "%s%einvalid_neg_size私はガラスを食べられます.gd2" is not a valid GD2 file in %s%ebug71912-mb.php on line %d
24OK
25