Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions runtime/executor/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,20 @@ Result<executorch_flatbuffer::ExecutionPlan*> get_execution_plan(
"Program validation failed: likely a corrupt file");
#else
ET_LOG(
Error,
Info,
"InternalConsistency verification requested but not available; "
"build with ET_ENABLE_PROGRAM_VERIFICATION=1");
return Error::NotSupported;
"falling back to Minimal verification. "
"Build with ET_ENABLE_PROGRAM_VERIFICATION=1 for full verification.");
#endif
} else {
// Verification::Minimal: Verify that the root table offset is within
// bounds. This is done in InternalConsistency by VerifyProgramBuffer.
}

if (verification == Verification::Minimal
#if !ET_ENABLE_PROGRAM_VERIFICATION
|| verification == Verification::InternalConsistency
#endif
) {
// Verify that the root table offset is within bounds.
// In InternalConsistency mode this is done by VerifyProgramBuffer above.
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment about InternalConsistency here is now misleading in builds where ET_ENABLE_PROGRAM_VERIFICATION is disabled: in that configuration an InternalConsistency request falls back and VerifyProgramBuffer is not called above. Consider rewording to clarify that the root-offset check is redundant only when InternalConsistency verification is actually available/enabled.

Suggested change
// In InternalConsistency mode this is done by VerifyProgramBuffer above.
// This check is also covered by VerifyProgramBuffer when full
// InternalConsistency verification is enabled and runs above.

Copilot uses AI. Check for mistakes.
uint32_t root_offset =
flatbuffers::ReadScalar<flatbuffers::uoffset_t>(program_data->data());
// The root table is at buf + root_offset. It must not point into the
Expand Down
Loading