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

Stefano Sabatini stefasab at gmail.com
Wed Jun 5 16:21:27 EEST 2024


On date Wednesday 2024-06-05 13:14:01 +0200, Andreas Rheinhardt wrote:
> Stefano Sabatini:
[...]
> >> One does not need two checks as long as int is 32 bits (because then one
> >> can just perform the addition in 64bits).
> > 
> > sizeof(int) is not defined by the C standard, so you cannot assume it
> > is 32 bits (even if on most platforms/compilers it will be)
> > 
> 

> Did you even read the following? It handles the case where simply using
> 64bits is not enough.

Yes, but there is no need to mix types, introduce ifdeffery and make
more assumptions when there is a simpler solution, please let's stick
at that.
 
> >> Just use the following (#if
> >> has been used because compilers have a tendency to emit warnings if a
> >> particular check is tautologically false):
> >>
> >> #if INT_MAX > INT64_MAX - HEADER_SIZE
> >>     if (raw_img_size > INT64_MAX - HEADER_SIZE)
> >>         return AVERROR(ERANGE);
> >> #endif


More information about the ffmpeg-devel mailing list