From: Fiona Glaser Date: Thu, 3 Dec 2009 03:55:45 +0000 (-0800) Subject: Fix crash in interlaced with >8 refs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f851c923d59fbaa73bf1148be3b796b043a7e187;p=libx264 Fix crash in interlaced with >8 refs Crash introduced in weightp. --- diff --git a/common/common.h b/common/common.h index eab28e18..0ba8fb98 100644 --- a/common/common.h +++ b/common/common.h @@ -256,7 +256,7 @@ typedef struct } ref_pic_list_order[2][16]; /* P-frame weighting */ - x264_weight_t weight[16][3]; + x264_weight_t weight[32][3]; int i_mmco_remove_from_end; int i_mmco_command_count; diff --git a/encoder/encoder.c b/encoder/encoder.c index 8f72e3f6..7c20ff39 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -1202,7 +1202,7 @@ static void x264_weighted_pred_init( x264_t *h ) // and duplicates of that frame. h->fenc->i_lines_weighted = 0; - for( i_ref = 0; i_ref < h->i_ref0; i_ref++ ) + for( i_ref = 0; i_ref < (h->i_ref0 << h->sh.b_mbaff); i_ref++ ) for( i = 0; i < 3; i++ ) h->sh.weight[i_ref][i].weightfn = NULL;