[PATCH] D43958: [llvm-readobj][ELF] Move ELF note parsing into lib/Object
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 2 08:13:09 PST 2018
Right, I mis-phrased that. What I should say is there are no bounds in
scope, because the struct does not contain a reference to its container.
The new methods in ELFFile do have the bound in scope, and they pass it
along to the iterator to do the checking. The getName and getDesc
methods on the Nhdr struct could also accept a bound and do a check, but
the intent of the patch is to not require the user of the library to
know those details. That is why the constructors on the iterator are
private, to encourage using the ELFFile interface to ensure proper
bounds checks. I would also make the Nhdr struct hide more information,
but that is not the approach taken by any of the surrounding header
types.
Regards,
Scott
On 2018-03-01 15:44, Rafael Avila de Espindola wrote:
> scott at scottlinder.com writes:
>
>> Hi Rafael,
>>
>> There is no bound to reference here; only in the context of the
>> containing section or program header are there bounds to check.
>
> I am not sure I understand. A broken file can have any n_namesz value,
> no? It could point past the end of the file.
>
> Cheers,
> Rafael
More information about the llvm-commits
mailing list