[Ffmpeg-devel] [PATCH] from DivX, Part 13: NULL callback calls
Steve Lhomme
steve.lhomme
Sat Dec 17 04:25:35 CET 2005
Michael Niedermayer wrote:
> Hi
>
> On Fri, Dec 16, 2005 at 04:03:58PM -1000, Steve Lhomme wrote:
>
>>Some tests to avoid calling NULL callbacks.
>
>
>>Index: libavcodec/imgconvert.c
>>===================================================================
>>RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/imgconvert.c,v
>>retrieving revision 1.58
>>diff -u -r1.58 imgconvert.c
>>--- libavcodec/imgconvert.c 11 Jul 2005 00:43:21 -0000 1.58
>>+++ libavcodec/imgconvert.c 17 Dec 2005 01:51:48 -0000
>>@@ -256,7 +256,7 @@
>> int i;
>>
>> for (i=0; i < PIX_FMT_NB; i++)
>>- if (!strcmp(pix_fmt_info[i].name, name))
>>+ if (pix_fmt_info[i].name && !strcmp(pix_fmt_info[i].name, name))
>
>
> a pixel format with no name is a bug
A crash is a bigger bug IMO. You can't wait for a software to crash to
solve possible problems. Maybe I just added the test just in case, I
don't remember that one.
>> break;
>> return i;
>> }
>>Index: libavcodec/utils.c
>>===================================================================
>>RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/utils.c,v
>>retrieving revision 1.162
>>diff -u -r1.162 utils.c
>>--- libavcodec/utils.c 2 Dec 2005 00:12:37 -0000 1.162
>>+++ libavcodec/utils.c 17 Dec 2005 01:58:36 -0000
>>@@ -962,7 +962,7 @@
>> return -1;
>> }
>>
>>- if (avctx->codec->close)
>>+ if (avctx->codec && avctx->codec->close)
>> avctx->codec->close(avctx);
>
>
> how did this become NULL here?
IIRC that was for some raw DV samples. But I could be wrong.
More information about the ffmpeg-devel
mailing list