On Mon, Jun 22, 2026, at 6:33 AM, Mark Wielaard wrote:
> Looks like the compiler cannot easily see that the loop is bounded by
> MIN (ebl->frame_nregs, dwarf_to_perf_len). Maybe do something like:
>
> size_t max_reg = MIN (ebl->frame_nregs, dwarf_to_perf_len);
> for (size_t i = 0; i < max_reg; i++)
>
> Or maybe dwarf_to_perf_len never is bigger than ebl->frame_nregs?
> Then we could just assert that and just loop till dwarf_to_perf_len.

re: mjw's question, seeing dwarf_to_perf_len > ebl->frame_nregs
would require initializing an i386 EBL {with ebl->frame_nregs small}
and attempting to use it to process x86_64 profiling packets
{with is_abi32 false), which is improbable but not impossible.

I would still approve the fix even as currently written, but it's worth
considering whether we should have this case fail with
return false instead of asserting or silently cutting off the second
half of the x86_64 register file. 

All the best,
      Serhei

Reply via email to