[FFmpeg-devel] bad arguments to init_put_bits

Dyami Caliri dyami at dragonframe.com
Thu Feb 26 19:42:06 CET 2015

The init_put_bits() function (in libavcodec/put_bits.h) takes a buffer and
a buffer size (in bytes). Several of the encoders are passing the buffer
size in bits, by multiplying the buffer size by 8. This is incorrect.

We saw this problem when encoding a ProRes (Anatoliy) file at size
4096x4096. Debugging showed that the buffer size was very large, and when
multiplied by 8, it was interpreted as a negative number. This caused
the init_put_bits()
to zero out the buffer, leading to a crash.

The attached patch fixes the argument to init_put_bits in all of the cases
where the buffer size was multiplied by 8.

You could use the patch or make the same change.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_init_put_bits.patch.tar
Type: application/x-tar
Size: 7680 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150226/3847d398/attachment.tar>

More information about the ffmpeg-devel mailing list