On Wed, Apr 15, 2009 at 03:26:28PM +0200, Michael Niedermayer wrote:
On Wed, Apr 15, 2009 at 02:40:43PM +0200, Reimar D?ffinger wrote:
If you had a look at the CDXL demuxer I think the issue is similar: you have a header which contains the size of video and palette packets and some other information the decoder needs anyway. You can either manually write the information the decoder needs into a manually allocated AVPacket, hoping someone will notice the missing integer overflow check, or you just read the header via av_get_packet, extract the sizes, and use av_append_packet to have a full video packet with all the info necessary.
realloc() is not free, it needs time and i dont like doing 1 realloc call per packet if it can be avoided.
We are talking about packets that will often be 4 - 32 bytes before, it may not be free, but AV_WL32 or whatever isn't free either.
and someone working with demuxers or decoders needs to understand the issues with integer overflows IMHO
There's a difference between understanding and remembering each time you have to write yet another ten lines of completely boring boilerplate code or it simply gets more complex (which I am sure you know, unless you intend to claim r18405 r18393 r18388 all were necessary only because someone did not understand the issues with buffer overflows...).