[FFmpeg-devel] [PATCH v2] avcodec: add farbfeld encoder

Tomas Härdin git at haerdin.se
Mon Jun 3 15:10:59 EEST 2024


This format seems to reproduce some of the same issues as QOI:

> The RGB-data should be sRGB for best interoperability and not alpha-
> premultiplied.

This seems to imply it could be something other than sRGB since it says
SHOULD rather than MUST. This probably isn't a huge issue, but it
should be clearer on the website. It also doesn't say whether alpha is
linear or not.

> +    int pkt_size = HEADER_SIZE + av_image_get_buffer_size(
> +        p->format,
> +        p->width,
> +        p->height,
> +        1
> +    );

Check the return value of av_image_get_buffer_size() before adding
HEADER_SIZE to it. There will be a signed overflow (UB) for images of
size 16385x16385 (and many others).

Aside: av_image_get_buffer_size() will UB for sizes above INT_MAX
because the size_t's in sizes[] get accumulated into an int. Besides
the UB it also returns incorrect values.

/Tomas


More information about the ffmpeg-devel mailing list