]> granicus.if.org Git - libx264/commitdiff
slightly wrong memory allocation in r717, fixes a potential crash with merange>32
authorLoren Merritt <pengvado@videolan.org>
Tue, 8 Jan 2008 18:10:51 +0000 (18:10 +0000)
committerLoren Merritt <pengvado@videolan.org>
Tue, 8 Jan 2008 18:10:51 +0000 (18:10 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@718 df754926-b1dd-0310-bc7b-ec298dee348c

encoder/analyse.c
encoder/me.c

index 84074a457eb4ef87099bfc81b0d96931cb69c85c..c2c5fec4fc5ae4c32d3f177c8e4f13d32eeae995 100644 (file)
@@ -196,7 +196,7 @@ static void x264_mb_analyse_load_costs( x264_t *h, x264_mb_analysis_t *a )
         {
             x264_cost_mv_fpel[a->i_qp][j] = x264_malloc( (4*2048 + 1) * sizeof(int16_t) );
             x264_cost_mv_fpel[a->i_qp][j] += 2*2048;
-            for( i = -2*2048; i <= 2*2048; i++ )
+            for( i = -2*2048; i < 2*2048; i++ )
                 x264_cost_mv_fpel[a->i_qp][j][i] = p_cost_mv[a->i_qp][i*4+j];
         }
     }
index 52982a417dd8ae78699aba8e2532dc48352368d3..9706cd45f4330e6e65b44fb068d48f350f05d860 100644 (file)
@@ -474,7 +474,7 @@ me_hex2:
             int sad_size = i_pixel <= PIXEL_8x8 ? PIXEL_8x8 : PIXEL_4x4;
             int delta = x264_pixel_size[sad_size].w;
             int16_t xs_buf[64];
-            int16_t *xs = width<=64 ? xs_buf : x264_malloc( width*sizeof(int16_t) );
+            int16_t *xs = width<=64 ? xs_buf : x264_malloc( (width+15)*sizeof(int16_t) );
             int xn;
             uint16_t *cost_fpel_mvx = x264_cost_mv_fpel[h->mb.i_qp][-m->mvp[0]&3] + (-m->mvp[0]>>2);