[x264-devel] Fix undefined behavior in x264_ratecontrol_mb

Jason Garrett-Glaser git at videolan.org
Tue Apr 23 23:03:03 CEST 2013


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Thu Feb 28 13:32:37 2013 -0800| [e355b0e12d6cb380c13cdce15b42093eb8eeef44] | committer: Jason Garrett-Glaser

Fix undefined behavior in x264_ratecontrol_mb

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

 encoder/ratecontrol.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 947aeda..2157301 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -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;
         }
     }



More information about the x264-devel mailing list