Skip to content

Unchecked libavif return values #16427

Closed
Closed
@cmb69

Description

@cmb69

Description

I've just noticed a build failure on FreeBSD:

/tmp/cirrus-ci-build/ext/gd/libgd/gd_avif.c:396:2: error: ignoring return value of function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result]
  396 |         avifRGBImageAllocatePixels(&rgb);

As of libavif 1.0.0, avifRGBImageAllocatePixels() has a return value which can be checked. As of libavif 1.1.0, the underlying avifAlloc() no longer abort()s on OOM conditions, so the return value of avifRGBImageAllocatePixels() needs to be checked; otherwise bad things are likely to happen.

Given that we only require libavif >= 0.8.2, and that the official Windows builds are still using 0.9.0, but some users (e.g. our FreeBSD CI builds) use newer libavif versions, we need to have preprocessor guards, to deal with that.

And we should check whether other relevant libavif API changes have happened.

This issue should also be reported/fixed upstream.

PHP Version

PHP >= 8.1

Operating System

any

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions