]> granicus.if.org Git - libx264/commitdiff
Fix undefined behavior: shift exponent is negative
authorAnton Mitrofanov <BugMaster@narod.ru>
Sun, 1 Mar 2020 11:44:09 +0000 (14:44 +0300)
committerAnton Mitrofanov <BugMaster@narod.ru>
Thu, 9 Apr 2020 12:36:22 +0000 (15:36 +0300)
common/x86/mc-c.c

index f96483e529a17b2b690880b55f3ff3fac60efc15..7b921319ddcd4c545d8939f5edd2b55ca3fa4331 100644 (file)
@@ -537,7 +537,7 @@ static void weight_cache_mmx2( x264_t *h, x264_weight_t *w )
         return;
     }
     w->weightfn = h->mc.weight;
-    den1 = 1 << (w->i_denom - 1) | w->i_offset << w->i_denom;
+    den1 = w->i_offset << w->i_denom | (w->i_denom ? 1 << (w->i_denom - 1) : 0);
     for( i = 0; i < 8; i++ )
     {
         w->cachea[i] = w->i_scale;