]> granicus.if.org Git - libx264/commitdiff
Fix crash in interlaced with >8 refs
authorFiona Glaser <fiona@x264.com>
Thu, 3 Dec 2009 03:55:45 +0000 (19:55 -0800)
committerFiona Glaser <fiona@x264.com>
Sat, 5 Dec 2009 08:52:12 +0000 (00:52 -0800)
Crash introduced in weightp.

common/common.h
encoder/encoder.c

index eab28e18403ae3d8b75840e39a98b9f5d0c84f47..0ba8fb984d8d79f7141559c85cb9d073a748c325 100644 (file)
@@ -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;
index 8f72e3f6b0adc96728d3401136959296d2f28059..7c20ff392c8091646bf71532e4a28adfe7ab5ddc 100644 (file)
@@ -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;