xref: /PHP-8.1/ext/gd/tests/bug74435.phpt (revision a375d547)
1--TEST--
2Bug #74435 (Buffer over-read into uninitialized memory)
3--EXTENSIONS--
4gd
5--FILE--
6<?php
7$im = imagecreatefromgif(__DIR__ . DIRECTORY_SEPARATOR . 'bug74435.gif');
8var_dump($im);
9$width = imagesx($im);
10$height = imagesy($im);
11for ($i = 0; $i < $width; $i += 16) {
12    for ($j = 0; $j < $height; $j += 16) {
13        if (($index = imagecolorat($im, $i, $j)) >= 2) {
14            list($red, $green, $blue, $alpha) = array_values(imagecolorsforindex($im, $index));
15            if ($red !== 0 || $green !== 0 || $blue !== 0 || $alpha !== 0) {
16                echo "unexpected color at ($i, $j)\n";
17            }
18        }
19    }
20}
21?>
22--EXPECT--
23object(GdImage)#1 (0) {
24}
25