[FFmpeg-devel] [RFC] WC3 decoder without AVPaletteControl

Reimar Döffinger Reimar.Doeffinger
Sat Nov 20 18:38:56 CET 2010


On Sat, Nov 20, 2010 at 05:14:25PM +0100, Michael Niedermayer wrote:
> > @@ -48,7 +49,7 @@
> >  int av_new_packet(AVPacket *pkt, int size)
> >  {
> >      uint8_t *data= NULL;
> > -    if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
> > +    if((unsigned)size <= INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
> >          data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
> >      if (data){
> >          memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
> 
> i think av_malloc alraedy protects us against this, that said if you prefer
> then this change is surely ok as a seperate commit

I didn't like the idea of relying on it, also because
av_malloc at least currently uses a hardcoded "16" (which I suspect is for the
"memalign hack" version) and not FF_INPUT_BUFFER_PADDING_SIZE.

> >  int av_dup_packet(AVPacket *pkt)
> >  {
> >      if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {
> 
> that should also be seperate from xan/wc* ideally

Yes, I will of course commit the separately, first the extra av_new_packet check,
then the grow_packet, then the append function and last the wc3 change was the plan.

> > Index: libavformat/avformat.h
> > ===================================================================
> > --- libavformat/avformat.h	(revision 25774)
> > +++ libavformat/avformat.h	(working copy)
> > @@ -245,6 +245,17 @@
> >  int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size);
> >  
> >  
> > +/**
> > + * Reads data and appends it to the current content of the AVPacket.
> > + * If pkt->size is 0 it behaves like av_get_packet.
> 
> This should mention that its inefficient and better to allocate a correctly
> sized packet

Done.
More comments?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wc3_pal.diff
Type: text/x-diff
Size: 16525 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101120/2c9ca5c2/attachment.diff>



More information about the ffmpeg-devel mailing list