Skip to content

Commit

Permalink
coredump: fix crash dump failed when items of pr_regs not equal with …
Browse files Browse the repository at this point in the history
…regs_num

elf_emit_tcb_note: nitems(status.pr_regs) is 18, g_tcbinfo.regs_num is 17, then g_tcbinfo.reg_off.p[17] has been out of bounds

Signed-off-by: wanggang26 <[email protected]>
  • Loading branch information
gneworld committed Jan 19, 2025
1 parent c937899 commit adc4bf2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sched/misc/coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo,

if (regs != NULL)
{
for (i = 0; i < nitems(status.pr_regs); i++)
for (i = 0; i < MIN(nitems(status.pr_regs), g_tcbinfo.regs_num); i++)
{
if (g_tcbinfo.reg_off.p[i] != UINT16_MAX)
{
Expand Down

0 comments on commit adc4bf2

Please sign in to comment.