diff options
Diffstat (limited to 'elf')
| -rw-r--r-- | elf/header.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/elf/header.lua b/elf/header.lua index 3efce7b..4ea8434 100644 --- a/elf/header.lua +++ b/elf/header.lua @@ -26,6 +26,12 @@ local ec = require("elf.constants") local M = {} function M.normalize(hdr) + assert(type(hdr) == "table", "header must be a table") + assert(hdr.class ~= nil, "missing header field: class") + assert(hdr.data ~= nil, "missing header field: data") + assert(hdr.type ~= nil, "missing header field: type") + assert(hdr.machine ~= nil, "missing header field: machine") + hdr.magic = hdr.magic or { 0x7f, 0x45, 0x4c, 0x46 } hdr.ident_version = hdr.ident_version or ec.VERSION hdr.osabi = hdr.osabi or ec.Osabi.sysv |
