Skip to content
Open
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
17 changes: 10 additions & 7 deletions runtime/executor/method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,17 @@ class BackendDelegate final {
}

// Parse compilation specs from program
CompileSpec* compile_specs;
Error err = PopulateCompileSpecs(
delegate.compile_specs(), backend_init_context, &compile_specs);
if (err != Error::Ok) {
ET_LOG(Error, "Failed to get compile specs for backend %s", backend_id);
return err;
CompileSpec* compile_specs = nullptr;
size_t num_compile_specs = 0;
if (delegate.compile_specs() != nullptr) {
Error err = PopulateCompileSpecs(
delegate.compile_specs(), backend_init_context, &compile_specs);
if (err != Error::Ok) {
ET_LOG(Error, "Failed to get compile specs for backend %s", backend_id);
return err;
}
num_compile_specs = delegate.compile_specs()->size();
}
Comment on lines 88 to 99
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

Consider adding a regression test that loads a Program/BackendDelegate where the compile_specs vector is omitted (i.e., FlatBuffer field unset so delegate.compile_specs() is null) and verifies delegate init succeeds and the backend receives an empty ArrayRef<CompileSpec> (size 0). This prevents future changes from reintroducing the null-deref/crash this PR fixes.

Copilot uses AI. Check for mistakes.
size_t num_compile_specs = delegate.compile_specs()->size();

out->backend_ = backend;
out->handle_ = nullptr;
Expand Down
Loading