On Tue, Dec 06, 2016 at 04:53:12AM -0700, Jan Beulich wrote:
> Just like elf_shdr_count(), elf_phdr_count() better bounds checks the
> value.
>
> Add table entry size checks to elf_init().
>
> Also both program and section headers are optional, and hence their
> checking better is done conditiona
On Tue, Dec 06, 2016 at 06:37:30AM -0700, Jan Beulich wrote:
> >>> On 06.12.16 at 14:27, wrote:
> >> unsigned elf_shdr_count(struct elf_binary *elf)
> >> {
> >> unsigned count = elf_uval(elf, elf->ehdr, e_shnum);
> >> -uint64_t max = elf->size / sizeof(Elf32_Shdr);
> >> +uint64_t ma
>>> On 06.12.16 at 14:27, wrote:
>> unsigned elf_shdr_count(struct elf_binary *elf)
>> {
>> unsigned count = elf_uval(elf, elf->ehdr, e_shnum);
>> -uint64_t max = elf->size / sizeof(Elf32_Shdr);
>> +uint64_t max;
>>
>> +if ( !count )
>> +return 0;
>> +max = elf->si
. snip..
All that above makes sense (and please put Reviewed-by from me on it), but this:
> unsigned elf_shdr_count(struct elf_binary *elf)
> {
> unsigned count = elf_uval(elf, elf->ehdr, e_shnum);
> -uint64_t max = elf->size / sizeof(Elf32_Shdr);
> +uint64_t max;
>
> +if ( !c
Just like elf_shdr_count(), elf_phdr_count() better bounds checks the
value.
Add table entry size checks to elf_init().
Also both program and section headers are optional, and hence their
checking better is done conditionally only when any such headers are
present.
Signed-off-by: Jan Beulich
-