A lot of model-file security work starts and ends with "is there a pickle in here?" For good reason: a pickle can run code on load, so scanners disassemble it. An ExecuTorch .pte program has no pickle. It is a FlatBuffer. So what is there to check?
The answer is: every size, every offset, and every index the runtime trusts.
What a .pte actually is
A .pte file is a FlatBuffer with the file identifier ET12 and the schema in schema/program.fbs . When a program carries data segments (weights, mutable initial state, named data, backend delegate blobs), an extended header eh00 sits at offset 8 and declares, as little-endian integers, the program size, where the segment data starts ( segment_base_offset ), and the segment data size. The constant weights, mutable state and delegate blobs then live in those segments, and the FlatBuffer refers to them by (segment_index, offset, size) and by indexes into tables of values, operators and delegates.
The runtime reads those numbers and uses them.β¦