Skip to content

Commit be39787

Browse files
committed
stress-branch: initialize branch_jmps to zero
When branch_jmps is not initialized shift ends up being a garbage value which can then make idx garbage when an undefined shift size occurs causing a SIGSEGV when indexing into the counts array. Fix this by initializing branch_jmps to zero. Fixes: 082483d ("stress-branch: add --branch-jumps option and double branch targets") Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
1 parent 0dd1817 commit be39787

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

stress-branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int OPTIMIZE2 stress_branch(stress_args_t *args)
375375
register uint32_t idx = 0;
376376
register const void *label_next = labels[idx];
377377
register uint32_t shift = 26;
378-
size_t branch_jumps;
378+
size_t branch_jumps = 0;
379379

380380
(void)stress_setting_get("branch-jumps", &branch_jumps);
381381
shift -= branch_jumps;

0 commit comments

Comments
 (0)