[libav-devel] [PATCH v2] zerocodec: check if there is previous frame
From: Paul B Mahol one...@gmail.com Signed-off-by: Paul B Mahol one...@gmail.com --- libavcodec/zerocodec.c |4 1 file changed, 4 insertions(+) diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index 6c57e05..7a0ba34 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, pic-key_frame = 1; pic-pict_type = AV_PICTURE_TYPE_I; } else { +if (!prev) { +av_log(avctx, AV_LOG_ERROR, No previous frame!\n); +return AVERROR_INVALIDDATA; +} pic-key_frame = 0; pic-pict_type = AV_PICTURE_TYPE_P; } -- 1.7.10 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH v2] zerocodec: check if there is previous frame
On Fri, May 04, 2012 at 12:32:43PM -0400, Derek Buitenhuis wrote: From: Paul B Mahol one...@gmail.com Signed-off-by: Paul B Mahol one...@gmail.com --- libavcodec/zerocodec.c |4 1 file changed, 4 insertions(+) diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index 6c57e05..7a0ba34 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, pic-key_frame = 1; pic-pict_type = AV_PICTURE_TYPE_I; } else { +if (!prev) { +av_log(avctx, AV_LOG_ERROR, No previous frame!\n); +return AVERROR_INVALIDDATA; +} pic-key_frame = 0; pic-pict_type = AV_PICTURE_TYPE_P; } -- OK ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH v2] zerocodec: check if there is previous frame
On Fri, May 04, 2012 at 12:32:43PM -0400, Derek Buitenhuis wrote: From: Paul B Mahol one...@gmail.com .. if there is _a_ previous .. --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -65,6 +65,10 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, pic-key_frame = 1; pic-pict_type = AV_PICTURE_TYPE_I; } else { +if (!prev) { +av_log(avctx, AV_LOG_ERROR, No previous frame!\n); +return AVERROR_INVALIDDATA; I admittedly don't know the surrounding code, but the error message does not make much sense to me. Why is the lack of a previous frame an error condition? And when does this happen except on the first frame? Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH v2] zerocodec: check if there is previous frame
On 04/05/2012 12:48 PM, Diego Biurrun wrote: I admittedly don't know the surrounding code, but the error message does not make much sense to me. Why is the lack of a previous frame an error condition? And when does this happen except on the first frame? ZeroCodec relies on the keyframe flag being set in the container, and prev is the previously decoded frame. So, e.g., if you have a file with incorrect or missing keyframe flags, this can happen. - Derek ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH v2] zerocodec: check if there is previous frame
On 5/4/2012 10:54 PM, Derek Buitenhuis wrote: On 04/05/2012 12:48 PM, Diego Biurrun wrote: I admittedly don't know the surrounding code, but the error message does not make much sense to me. Why is the lack of a previous frame an error condition? And when does this happen except on the first frame? ZeroCodec relies on the keyframe flag being set in the container, and prev is the previously decoded frame. So, e.g., if you have a file with incorrect or missing keyframe flags, this can happen. [...] I am in favor of using a more comprehensive error message here. Just saying ... Shakkhar ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel