[Lldb-commits] [PATCH] Update ObjectFileELF to detect ELF triple based on ELF notes and the ELF header.
Ed Maste
emaste at freebsd.org
Fri Jun 27 08:18:03 PDT 2014
Thanks Todd, I'm very happy to see this go in!
================
Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1101
@@ +1100,3 @@
+ uint32_t version_info;
+ if (data.GetU32 (&offset, &version_info, 1) == nullptr)
+ {
----------------
Todd Fiala wrote:
> Ed Maste wrote:
> > Should we validate that the descsz is as expected in here too? E.g. `(note.n_name == LLDB_NT_OWNER_FREEBSD && note.n_type == LLDB_NT_FREEBSD_ABI_TAG && note.n_descsz == 4)`
> I could do that. It will fail either way if it's less than the expected size (i.e. if we go down the path of processing a note with an owner of LLDB_NT_OWNER_FREEBSD and a note type of LLDB_NT_FREEBSD_ABI_TAG) since the read will fail.
>
> It might be worth putting a warning in the code if the size doesn't match expectations - that way we'd at least be able to track down what was breaking if we found the note but it didn't match size expectations. (i.e. effectively a change in the note definition or a broken code emitter).
I was thinking of the other case. if the size recorded in the file is larger than the data. We'd then partially consume the payload and then try to read a subsequent ELF note from the wrong location, no?
http://reviews.llvm.org/D4302
More information about the lldb-commits
mailing list