]> git.sesse.net Git - x264/commitdiff
Fix undefined behavior in x264_ratecontrol_mb
authorFiona Glaser <fiona@x264.com>
Thu, 28 Feb 2013 21:32:37 +0000 (13:32 -0800)
committerFiona Glaser <fiona@x264.com>
Sat, 13 Apr 2013 17:36:24 +0000 (10:36 -0700)
encoder/ratecontrol.c

index 8f24ccc8ae72b40374705f4b88f9afb1c780ddde..cd76293a28662d338c64837ac67819a1ab4af827 100644 (file)
@@ -1667,7 +1667,8 @@ int x264_ratecontrol_mb( x264_t *h, int bits )
             rc->qpm = x264_clip3f( (prev_row_qp + rc->qpm)*0.5f, prev_row_qp + 1.0f, qp_max );
             rc->qpa_rc = rc->qpa_rc_prev;
             rc->qpa_aq = rc->qpa_aq_prev;
-            h->fdec->i_row_bits[y] = h->fdec->i_row_bits[y-SLICE_MBAFF] = 0;
+            h->fdec->i_row_bits[y] = 0;
+            h->fdec->i_row_bits[y-SLICE_MBAFF] = 0;
             return -1;
         }
     }
@@ -1683,7 +1684,8 @@ int x264_ratecontrol_mb( x264_t *h, int bits )
             rc->qpm = qp_max;
             rc->qpa_rc = rc->qpa_rc_prev;
             rc->qpa_aq = rc->qpa_aq_prev;
-            h->fdec->i_row_bits[y] = h->fdec->i_row_bits[y-SLICE_MBAFF] = 0;
+            h->fdec->i_row_bits[y] = 0;
+            h->fdec->i_row_bits[y-SLICE_MBAFF] = 0;
             return -1;
         }
     }