On Sat, Sep 05, 2020 at 01:17:09AM +0200, Andreas Rheinhardt wrote: > Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com> > --- > Is it actually guaranteed that the allocated packet size is > sufficient? If it is, one could use unchecked writes throughout; if it > isn't, should I add a check to properly error out in case the buffer is > too small? (And what would the return value be in this case?) > > libavcodec/jpeglsenc.c | 80 +++++++++++++++++++++--------------- > libavcodec/mjpegenc.h | 6 --- > libavcodec/mjpegenc_common.c | 6 +++ > 3 files changed, 52 insertions(+), 40 deletions(-) >
lgtm. Packet size may be smaller than needed, if there is no check it will fail. Usually it is allocated to max possible encoded packet size. Can not be sure, need to try encoding special pixels combinations that never happen in reality (almost). Ultimately some codecs check if encoded packet gonna exceed uncompressed frame than they just store uncompressed and properly mark bitstream. (Latest FFv1 encoder version, previous versions had this misfeature/bug) _______________________________________________ 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".