[FFmpeg-devel] [PATCH 1/4] lavf: add write_uncoded_frame() API.

Nicolas George george at nsup.org
Sat Jan 4 16:07:12 CET 2014


Le quintidi 15 nivôse, an CCXXII, Michael Niedermayer a écrit :
> a consistency check that triggers out of array writes doesnt seem
> that great
> 
> size = 'F' // AVFrame
> could be used but still this feels hackish
> 
> or a function could be added to libavutil to return the actual size
> of the AVFrame struct

In my mind, if an AVPacket contains a pointer to an AVFrame, it should not
be copied, and in fact its size should not be used at all. If it happens,
that is a bug in the library that needs fixing immediately.

Setting size to an absurdly large value will cause a crash immediately if
someone tries to copy it. That is easy to debug.

Setting size to the correct size, or almost the correct size, will cause the
data structure to be copied, but without incrementing the buffers' reference
count. That is very hard to debug.

Setting size to a very small value will cause the structure to be partially
copied. If we are lucky, the rest will be left uninitialized and valgrind
will catch it; if we are not, the rest will be blanked. Moderately hard to
debug.

So I still think that an absurdly large value is a good choice.

Or did I miss something?

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140104/23cb00a5/attachment.asc>


More information about the ffmpeg-devel mailing list