[PATCH] D74770: [test-suite] Work around undefined behaviour in ldecod

Oliver Stannard (Linaro) via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 07:12:06 PST 2020


ostannard created this revision.
ostannard added reviewers: lebedev.ri, kristof.beyls.
Herald added a project: LLVM.

The NUM_BLOCK_TYPES macro is defined to 10, but the arrays in ctx_tables.h only have 8 elements in the relevant dimension, so this was causing out of bounds array accesses, and segfaults if we were (un)lucky. I don't know enough about H264 <https://reviews.llvm.org/H264> decoding to know if this is the right fix, but it fixes the segfault currently affecting the Arm LNT bot, and doesn't change the expected output.


Repository:
  rT test-suite

https://reviews.llvm.org/D74770

Files:
  MultiSource/Applications/JM/ldecod/context_ini.c


Index: MultiSource/Applications/JM/ldecod/context_ini.c
===================================================================
--- MultiSource/Applications/JM/ldecod/context_ini.c
+++ MultiSource/Applications/JM/ldecod/context_ini.c
@@ -60,15 +60,15 @@
 
 
   //--- texture coding contexts ---
-  BIARI_CTX_INIT1 (                 NUM_IPR_CTX,  tc->ipr_contexts,     INIT_IPR,       img->model_number);
-  BIARI_CTX_INIT1 (                 NUM_CIPR_CTX, tc->cipr_contexts,    INIT_CIPR,      img->model_number);
-  BIARI_CTX_INIT2 (3,               NUM_CBP_CTX,  tc->cbp_contexts,     INIT_CBP,       img->model_number);
-  BIARI_CTX_INIT2 (8,               NUM_BCBP_CTX, tc->bcbp_contexts,    INIT_BCBP,      img->model_number);
-  BIARI_CTX_INIT2 (NUM_BLOCK_TYPES, NUM_MAP_CTX,  tc->map_contexts,     INIT_MAP,       img->model_number);
-  BIARI_CTX_INIT2 (NUM_BLOCK_TYPES, NUM_LAST_CTX, tc->last_contexts,    INIT_LAST,      img->model_number);
-  BIARI_CTX_INIT2 (NUM_BLOCK_TYPES, NUM_ONE_CTX,  tc->one_contexts,     INIT_ONE,       img->model_number);
-  BIARI_CTX_INIT2 (NUM_BLOCK_TYPES, NUM_ABS_CTX,  tc->abs_contexts,     INIT_ABS,       img->model_number);
-  BIARI_CTX_INIT2 (NUM_BLOCK_TYPES, NUM_MAP_CTX,  tc->fld_map_contexts, INIT_FLD_MAP,   img->model_number);
-  BIARI_CTX_INIT2 (NUM_BLOCK_TYPES, NUM_LAST_CTX, tc->fld_last_contexts,INIT_FLD_LAST,  img->model_number);
+  BIARI_CTX_INIT1 (   NUM_IPR_CTX,  tc->ipr_contexts,     INIT_IPR,       img->model_number);
+  BIARI_CTX_INIT1 (   NUM_CIPR_CTX, tc->cipr_contexts,    INIT_CIPR,      img->model_number);
+  BIARI_CTX_INIT2 (3, NUM_CBP_CTX,  tc->cbp_contexts,     INIT_CBP,       img->model_number);
+  BIARI_CTX_INIT2 (8, NUM_BCBP_CTX, tc->bcbp_contexts,    INIT_BCBP,      img->model_number);
+  BIARI_CTX_INIT2 (8, NUM_MAP_CTX,  tc->map_contexts,     INIT_MAP,       img->model_number);
+  BIARI_CTX_INIT2 (8, NUM_LAST_CTX, tc->last_contexts,    INIT_LAST,      img->model_number);
+  BIARI_CTX_INIT2 (8, NUM_ONE_CTX,  tc->one_contexts,     INIT_ONE,       img->model_number);
+  BIARI_CTX_INIT2 (8, NUM_ABS_CTX,  tc->abs_contexts,     INIT_ABS,       img->model_number);
+  BIARI_CTX_INIT2 (8, NUM_MAP_CTX,  tc->fld_map_contexts, INIT_FLD_MAP,   img->model_number);
+  BIARI_CTX_INIT2 (8, NUM_LAST_CTX, tc->fld_last_contexts,INIT_FLD_LAST,  img->model_number);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74770.245157.patch
Type: text/x-patch
Size: 2336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200218/dc988672/attachment.bin>


More information about the llvm-commits mailing list