On Fri, Aug 23, 2019 at 8:07 AM Nicolas George <geo...@nsup.org> wrote:
> > + if (nb_blocks - 1 > (SIZE_MAX - sizeof(AVEncodeInfoFrame)) / > sizeof(AVEncodeInfoBlock)) > > + return NULL; > > nb_blocks - 1 overflows for 0. Move the -1 right of the = as +1. > > > + //AVEncodeInfoFrame already allocates size for one element of > AVEncodeInfoBlock > > > + size_t size = sizeof(AVEncodeInfoFrame) - sizeof(AVEncodeInfoBlock) > + > > + FFMAX(1, nb_blocks) * sizeof(AVEncodeInfoBlock); > > This code would be better shared in an inline function or macro instead > of duplicated. With a macro, you can include the check. > I changed it to an inline function, returns SIZE_MAX if it fails to make av_malloc() fail and return NULL. Thanks for the feedback. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".