3 ms·
Ah, I see what you mean now. Yes, object/gimli are also this kind of low-level. Basically, when you parse the file, you're not actually parsing the file, but y
by jcranmer 5y ago
Ah, I see what you mean now.
Yes, object/gimli are also this kind of low-level. Basically, when you parse the file, you're not actually parsing the file, but you're parsing each element of the structure one bit of a time.
So parsing FileHeader will make sure a) the data is correctly aligned [since it's UB in Rust to have underaligned data] and b) that the e_ident bits are actually the magic number for an ELF file. Want to list all the sections? That's when it's actually going to check that a) the section header offset actually points to valid data and b) the number of section headers exist and is sane, but again, it doesn't actually verify that the section headers themselves make any sense whatsoever.