tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: KASSERT in exec_elf.c for DYN executable when p_align==0
Christos Zoulas wrote:
> In article <20180317225722.GA1538@neva>,
> Alexander Nasonov <alnsn%yandex.ru@localhost> wrote:
> >Coverity (CID 1427746) complains about a division by zero when
> >align is 0 in all PT_LOAD headers.
> >...
> >I would be nice to perform sanity checks of tainted executable
> >instead of panicing.
>
> Fixed, thanks.
But it doesn't fix CID 1427746. Given that both 0 and 1 specify no alignment,
the fix is simple:
- for (align = i = 0; i < eh->e_phnum; i++)
+ align = 1;
+ for (i = 0; i < eh->e_phnum; i++)
if (ph[i].p_type == PT_LOAD && ph[i].p_align > align)
align = ph[i].p_align;
Alex
Home |
Main Index |
Thread Index |
Old Index