From: Loren Merritt Date: Tue, 8 Jan 2008 18:10:51 +0000 (+0000) Subject: slightly wrong memory allocation in r717, fixes a potential crash with merange>32 X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=810c096dcb7f9b571540200a32e89b31ee964cca;p=x264.git slightly wrong memory allocation in r717, fixes a potential crash with merange>32 git-svn-id: svn://svn.videolan.org/x264/trunk@718 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/encoder/analyse.c b/encoder/analyse.c index 84074a45..c2c5fec4 100644 --- a/encoder/analyse.c +++ b/encoder/analyse.c @@ -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]; } } diff --git a/encoder/me.c b/encoder/me.c index 52982a41..9706cd45 100644 --- a/encoder/me.c +++ b/encoder/me.c @@ -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);