Hi, On Sat, Feb 18, 2012 at 6:52 AM, Justin Ruggles <[email protected]> wrote: > On 02/17/2012 06:35 PM, Ronald S. Bultje wrote: >> On Fri, Feb 17, 2012 at 3:27 PM, Justin Ruggles >> <[email protected]> wrote: >>> On 02/17/2012 05:49 PM, Ronald S. Bultje wrote: >>> >>>> From: "Ronald S. Bultje" <[email protected]> >>>> >>>> Prevents crash when trying to copy from a non-existing plane in e.g. >>>> a RGB32 reference image to a YUV420P target image >>>> >>>> Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind >>>> CC: [email protected] >>>> --- >>>> libavcodec/fraps.c | 16 ++++++++++++++++ >>>> 1 files changed, 16 insertions(+), 0 deletions(-) >>>> >>>> diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c >>>> index 3643325..1c1a451 100644 >>>> --- a/libavcodec/fraps.c >>>> +++ b/libavcodec/fraps.c >>>> @@ -160,6 +160,10 @@ static int decode_frame(AVCodecContext *avctx, >>>> case 0: >>>> default: >>>> /* Fraps v0 is a reordered YUV420 */ >>>> + if (avctx->pix_fmt != PIX_FMT_NONE && >>>> + avctx->pix_fmt != PIX_FMT_YUVJ420P && >>>> + f->data[0]) >>>> + avctx->release_buffer(avctx, f); >>>> avctx->pix_fmt = PIX_FMT_YUVJ420P; >>> >>> >>> Would checking the current avctx->pix_fmt against f->format not work? >> >> No, for the first frame, that is zero'ed (i.e. PIX_FMT_YUV420P), not >> PIX_FMT_NONE (-1). > > > When is it set to zero? The defaults for both AVCodecContext and AVFrame > are -1.
It's embedded in the private context, which is allocated using av_mallocz(). I'll send a new patch that is smaller. Ronald _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
