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

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Thu Feb 26 22:11:37 CET 2015


On 26.02.2015 20:48, Nicolas George wrote:
> 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);

You're right. New patch with this check attached.

> 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.

Indeed. I also attached a patch limiting the bit muxer to codec g729 with 1 
channel, as this is apparently the only thing it supports.

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

You already analyzed this.

Best regards,
Andreas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avformat-bit-check-that-pkt-size-is-10-in-write_pack.patch
Type: text/x-diff
Size: 866 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150226/db28a0cb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-avformat-bit-only-accept-the-g729-codec-and-1-channe.patch
Type: text/x-diff
Size: 1126 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150226/db28a0cb/attachment-0001.bin>


More information about the ffmpeg-devel mailing list