[x264-devel] Fix undefined behavior of left shift for CAVLC encoding

Anton Mitrofanov git at videolan.org
Tue Aug 7 00:05:24 CEST 2018


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Jul 18 21:56:33 2018 +0300| [1c3174775c6c1789aaf10172e4cb619f91ecff4a] | committer: Henrik Gramner

Fix undefined behavior of left shift for CAVLC encoding

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=1c3174775c6c1789aaf10172e4cb619f91ecff4a
---

 common/vlc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/vlc.c b/common/vlc.c
index 6e695d23..e00a01bc 100644
--- a/common/vlc.c
+++ b/common/vlc.c
@@ -71,7 +71,9 @@ void x264_cavlc_init( x264_t *h )
             vlc->i_next = i_next;
         }
 
-    for( int i = 1; i < (1<<16); i++ )
+    x264_run_before[0] = 0;
+    x264_run_before[1] = 0;
+    for( uint32_t i = 2; i < (1<<16); i++ )
     {
         x264_run_level_t runlevel;
         ALIGNED_ARRAY_16( dctcoef, dct, [16] );



More information about the x264-devel mailing list