From 810c096dcb7f9b571540200a32e89b31ee964cca Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Tue, 8 Jan 2008 18:10:51 +0000 Subject: [PATCH] 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 --- encoder/analyse.c | 2 +- encoder/me.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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); -- 2.47.3