[FFmpeg-devel] [PATCH] avio: deprecate url_ferror

Måns Rullgård mans
Tue Mar 8 14:04:00 CET 2011


"Ronald S. Bultje" <rsbultje at gmail.com> writes:

> Hi,
>
> On Mon, Mar 7, 2011 at 5:22 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
>> On Mon, Mar 7, 2011 at 4:00 PM, Anton Khirnov <anton at khirnov.net> wrote:
>>> AVIOContext.error should be used directly instead.
>>
>> Queued.
>
> I didn't push yet, because this patch breaks make fate-lavf-bmp (and
> possibly others):
>
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000078
> 0x00000001000ae1fa in av_interleaved_write_frame (s=0x10100e600,
> pkt=0x7fff5fbfe3e0) at
> /Users/ronaldbultje/Projects/ffmpeg-git/libavformat/utils.c:3114
> 3114	        if(s->pb->error)
> (gdb) print s
> $1 = (AVFormatContext *) 0x10100e600
> (gdb) print s->pb
> $2 = (AVIOContext *) 0x0
> (gdb) bt
> #0  0x00000001000ae1fa in av_interleaved_write_frame (s=0x10100e600,
> pkt=0x7fff5fbfe3e0) at
> /Users/ronaldbultje/Projects/ffmpeg-git/libavformat/utils.c:3114
> #1  0x000000010000223c in write_frame (s=0x10100e600,
> pkt=0x7fff5fbfe3e0, avctx=0x10100f800, bsfc=0x0) at
> /Users/ronaldbultje/Projects/ffmpeg-git/ffmpeg.c:746

I'd expect the same from all the img2 tests.  With this muxer, there is
no persistent AVIOContext (each frame is written to a different file)
yet the generic code in utils.c assumes the pointer will be valid.
The silly null checks were added way back in 2007 when the (then)
ByteIOContext in AVFormatContext was changed to a pointer.  Prior to
that an uninitialised ByteIOContext would have been used.

I also have to question the reason for those url_ferror() calls being
there in the first place.  The return value of the muxer's
write_packet() function is checked on the line before, and that should
include any error encountered while writing the data, or the muxer is
broken.  The calls were added in 576ae25 (svn r3572) with no explanation.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list