Re: [FFmpeg-devel] [PATCH] diracdec: check if reference could not be allocated
On 06.05.2015 02:26, Michael Niedermayer wrote: On Tue, May 05, 2015 at 11:51:48PM +0200, Andreas Cadhalpun wrote: s-ref_pics[i] is later used as ref argument of interpolate_refplane, where it is dereferenced. If it is NULL, it causes a segmentation fault. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com --- libavcodec/diracdec.c | 6 ++ 1 file changed, 6 insertions(+) applied though i would also prefer more expressive error codes I agree, but most of that file lacks proper error codes/forwarding. I'll see if I can fix this properly. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] diracdec: check if reference could not be allocated
On Tue, May 05, 2015 at 11:51:48PM +0200, Andreas Cadhalpun wrote: s-ref_pics[i] is later used as ref argument of interpolate_refplane, where it is dereferenced. If it is NULL, it causes a segmentation fault. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com --- libavcodec/diracdec.c | 6 ++ 1 file changed, 6 insertions(+) applied though i would also prefer more expressive error codes thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Breaking DRM is a little like attempting to break through a door even though the window is wide open and the only thing in the house is a bunch of things you dont want and which you would get tomorrow for free anyway signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] diracdec: check if reference could not be allocated
On 06.05.2015 00:00, Timothy Gu wrote: On Tue, May 5, 2015 at 2:51 PM Andreas Cadhalpun andreas.cadhal...@googlemail.com wrote: +if (!s-ref_pics[i]) { +av_log(s-avctx, AV_LOG_ERROR, Reference could not be allocated\n); +return -1; +} + AVERROR(ENOMEM) The problem is not caused by not having enough memory, but by running out of space in s-all_frames[j]. And anyway, the return code is not propagated: if (dirac_decode_picture_header(s)) return -1; Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] diracdec: check if reference could not be allocated
s-ref_pics[i] is later used as ref argument of interpolate_refplane, where it is dereferenced. If it is NULL, it causes a segmentation fault. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com --- libavcodec/diracdec.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 98f2ea9..2057014 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1749,6 +1749,12 @@ static int dirac_decode_picture_header(DiracContext *s) get_buffer_with_edge(s-avctx, s-ref_pics[i]-avframe, AV_GET_BUFFER_FLAG_REF); break; } + +if (!s-ref_pics[i]) { +av_log(s-avctx, AV_LOG_ERROR, Reference could not be allocated\n); +return -1; +} + } /* retire the reference frames that are not used anymore */ -- 2.1.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel