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

Reimar Döffinger Reimar.Doeffinger
Sat Dec 9 23:29:57 CET 2006


Hello,
currently jpegls regression tests fail on some (e.g. my) systems.
The reason is that due to the stuffing code the encoder might read and
store uninitialized data.
Attached patch just initializes 16 additional bits.
Ok to apply?

Greetings,
Reimar D?ffinger
-------------- next part --------------
Index: libavcodec/jpeg_ls.c
===================================================================
--- libavcodec/jpeg_ls.c	(revision 7265)
+++ libavcodec/jpeg_ls.c	(working copy)
@@ -804,9 +804,10 @@
     av_free(zero);
     av_free(state);
 
+    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;
     init_get_bits(&gb, buf2, size);
     while(get_bits_count(&gb) < size * 8){
         int v;



More information about the ffmpeg-devel mailing list