Skip to content

Unexpected nan value in ext/gd/libgd/gd_filter.c:386 #16255

Closed
@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
function makeFilter($resource, $matrix, $offset = 1.0)
{
return imageconvolution($resource, $matrix, $fusion, $offset);
}
$edgeMatrix = array(array(1, 0, 1), array(0, 5, 0), array(1, 0, 1));
$im = imagecreatetruecolor(40, 40);
makeFilter($im, $edgeMatrix);

Resulted in this output:

/php-src/ext/gd/libgd/gd_filter.c:386:45: runtime error: -nan is outside the range of representable values of type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/gd/libgd/gd_filter.c:386

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions