[FFmpeg-devel] [PATCH v7 1/2] avcodec/pngenc: support writing iCCP chunks

Niklas Haas ffmpeg at haasn.xyz
Tue Apr 5 13:59:32 EEST 2022


On Fri, 01 Apr 2022 15:31:16 +0200 Andreas Rheinhardt <andreas.rheinhardt at outlook.com> wrote:
> Passing the PNGEncContext would be more natural.

Changed.

> Since db57a5370bd37105d389a45b04bf4970802407ec the callers'
> max_packet_size are not size_t any more, but always 64bit (so that
> there's no truncation in case size_t is 32bit).

Changed.

> ULONG_MAX is the maximum of unsigned long, yet deflateBound uses uLong.
> The latter is a currently typedef for unsigned long, but do we want to
> rely on that? The ordinary way to check for whethe a value can be
> represented in a type is by "if (sd->size != (uLong)sd->size)"

Changed. I didn't know about this trick, thanks.

> AV_LOG_WARNING makes no sense given that you error out afterwards.
> (And anyway: Is a log-message really needed for something that will
> never happen in reality?)

I think you're right. For JPEG it makes sense to keep around an error
printout, because the JPEG profile limit is quite small in comparison
(16 MB - the largest ICC profiles I have encountered in the wild are on
the order of megabytes as well).

But PNG supports up to 4 GB ICC profiles, which strains all conceivable
credibility. Somebody would have to be deliberately trying to hit this
limitation. Removed both error printouts (including the one about zlib
misbehaving, equally unlikely).


More information about the ffmpeg-devel mailing list