Skip to content

Commit

Permalink
Merge pull request nasa#196 from skliper/Fix195-cf_chunck_ut_stacksmash
Browse files Browse the repository at this point in the history
Fix nasa#195, Stack smashing in CF_Chunk unit test
  • Loading branch information
astrogeco committed Feb 16, 2022
2 parents dbb94ab + 007b0b9 commit e391163
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions unit-test/cf_chunk_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -1459,12 +1459,13 @@ void Test_CF_Chunks_Insert_CallTo_CF_Chunks_CombineNext_Returns_0_CallTo_CF_Chun
CF_Chunk_t *arg_chunk = &dummy_chunk;

/* Arrange for CF_Chunks_CombineNext to return 0 and CF_Chunks_CombinePrevious to return 0 */
CF_ChunkIdx_t dummy_chunks_count = 10; /* 10 for dummy_chunks_count is arbitrary, chosen for speed */
CF_ChunkIdx_t dummy_chunks_count;
CF_Chunk_t dummy_chunks_chunks[10] = {{0}}; /* 10 repeated for dummy_chunks for build ability */
CF_ChunkList_t dummy_chunks;

arg_chunks = &dummy_chunks;
arg_chunks->max_chunks = UINT32_MAX;
arg_chunks->max_chunks = sizeof(dummy_chunks_chunks)/sizeof(dummy_chunks_chunks[0]);
dummy_chunks_count = arg_chunks->max_chunks - 1; /* Arbitrary, but selecting last slot */

arg_chunks->count = dummy_chunks_count;
arg_i = arg_chunks->count;
Expand Down Expand Up @@ -2698,4 +2699,4 @@ void UtTest_Setup(void)

} /* end UtTest_Setup for cf_chunk_tests.c */

/* end cf_chunk_tests.c */
/* end cf_chunk_tests.c */

0 comments on commit e391163

Please sign in to comment.