[Ffmpeg-devel] [PATCH] fix jpegls unitialized data reading

Reimar Döffinger Reimar.Doeffinger
Sat Dec 9 23:48:17 CET 2006


Hello,
On Sat, Dec 09, 2006 at 11:29:57PM +0100, Reimar D?ffinger wrote:
> +    put_bits(&pb2, 16, 0);
>      flush_put_bits(&pb2);
>      /* do escape coding */
> -    size = put_bits_count(&pb2) >> 3;
> +    size = (put_bits_count(&pb2) >> 3) - 2;

Just initializing 8 extra bits instead of 16 is enough, because v ==
0xff is not possible when we already hit the end before reading v
completely.
Actually that even means that 7 bits extra initialization would be
enough, but that would be complicate to compensate due to
flush_put_bits.
Of course, just a memset of buf2 to 0 right at the start works, too.

Greetings,
Reimar D?ffinger




More information about the ffmpeg-devel mailing list