Quoting Luca Barbato (2014-11-02 19:50:10)
> On 02/11/14 19:23, Anton Khirnov wrote:
> > Quoting Vittorio Giovara (2014-10-30 01:51:50)
> >> From: Luca Barbato <[email protected]>
> >>
> >> Do not assume that the frame passed has that field set to 0 by default.
> >>
> >> Bug-Id: CID 991853
> >> ---
> >>   libavcodec/utils.c | 6 ++++--
> >>   1 file changed, 4 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> >> index 95d2193..a9f0e17 100644
> >> --- a/libavcodec/utils.c
> >> +++ b/libavcodec/utils.c
> >> @@ -443,8 +443,10 @@ static int audio_get_buffer(AVCodecContext *avctx, 
> >> AVFrame *frame)
> >>               av_freep(&frame->extended_buf);
> >>               return AVERROR(ENOMEM);
> >>           }
> >> -    } else
> >> -        frame->extended_data = frame->data;
> >> +    } else {
> >> +        frame->extended_data   = frame->data;
> >> +        frame->nb_extended_buf = 0;
> >> +    }
> >>
> >>       for (i = 0; i < FFMIN(planes, AV_NUM_DATA_POINTERS); i++) {
> >>           frame->buf[i] = av_buffer_pool_get(pool->pools[0]);
> >> --
> >> 1.9.3 (Apple Git-50)
> >>
> >
> > No, this does not look right. If that field is non-zero, then the caller
> > messed up and should be fixed.
> >
> 
> I can AVERROR_BUG on the condition then.

That is not a sustainable pattern. You could randomly insert checks for
the validity of every possible parameter everywhere.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to