X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Ftest_vec.c;h=bc878eef51804607f88f8f2b56133c9056caad66;hb=7d476e03aa3832c4c5b2ec7fafbceddc070fd5d9;hp=ee17ef142447a1ec3fd876b822f1ddbf1f58177e;hpb=6a5adc369591fcac2447e9809deaa22f56b53911;p=vpp.git diff --git a/src/vppinfra/test_vec.c b/src/vppinfra/test_vec.c index ee17ef14244..bc878eef518 100644 --- a/src/vppinfra/test_vec.c +++ b/src/vppinfra/test_vec.c @@ -124,7 +124,7 @@ uword g_call_stats[OP_MAX]; /* A structure for both vector headers and vector elements might be useful to - uncover potential alignement issues. */ + uncover potential alignment issues. */ typedef struct { @@ -1079,6 +1079,7 @@ test_vec_main (unformat_input_t * input) uword help = 0; uword big = 0; uword align = 0; + uword ugly = 0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { @@ -1089,6 +1090,7 @@ test_vec_main (unformat_input_t * input) && 0 == unformat (input, "dump %d", &g_dump_period) && 0 == unformat (input, "help %=", &help, 1) && 0 == unformat (input, "big %=", &big, 1) + && 0 == unformat (input, "ugly %d", &ugly) && 0 == unformat (input, "align %=", &align, 1)) { clib_error ("unknown input `%U'", format_unformat_error, input); @@ -1096,6 +1098,19 @@ test_vec_main (unformat_input_t * input) } } + /* Cause a deliberate heap botch */ + if (ugly) + { + u8 *overrun_me = 0; + int i; + + vec_validate (overrun_me, 31); + for (i = 0; i < vec_len (overrun_me) + ugly; i++) + overrun_me[i] = i; + + vec_free (overrun_me); + } + if (big) { u8 *bigboy = 0; @@ -1158,8 +1173,6 @@ main (int argc, char *argv[]) clib_mem_init (0, 3ULL << 30); - // mheap_alloc (0, (uword) 10ULL << 30); - verbose = (argc > 1); unformat_init_command_line (&i, argv); ret = test_vec_main (&i);