[FFmpeg-devel] [PATCH] avformat/bit: return early from write_packet if pkt->size is 0

Nicolas George george at nsup.org
Thu Feb 26 20:48:47 CET 2015

L'octidi 8 ventôse, an CCXXIII, Andreas Cadhalpun a écrit :
> the bit format muxer currently segfaults, when it is passed a packet of size 0.
> This can be triggered e.g. with:
> ffmpeg -y -f lavfi -i sine=duration=0.1 -c:a flac -f bit /dev/null
> Attached patch fixes this.

This looks wrong. The "bit" muxer seems to assume packets have a constant
size, apparently 10 octets. Someone knowing the format should check, but I
suppose this would be more correct:

        if (pkt->size != 10)
            return AVERROR(EINVAL);

Also, it seems you should not be able to mux FLAC into this format, the
write header callback does not validate enough. It looks like this muxer is
a quick-and-dirty implementation, emphasis on the dirty.

Last: how come ffmpeg/lavf tries to mux an empty packet?


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150226/2a5c6a56/attachment.asc>

More information about the ffmpeg-devel mailing list