Skip to content

Commit 3217c55

Browse files
author
Github Executorch
committed
Fix multiple XNNPACK compiler security issues (#35, #36, #37, #39, #41, #42)
Harden XNNCompiler.cpp against malicious or corrupt flatbuffer inputs: #35 - Add null checks for flatbuffer_graph, xvalues(), and xnodes() before dereferencing to prevent null pointer crashes. #36 - Replace all remapped_ids.at() calls with a safe REMAP_ID macro that uses find() + error return, preventing std::out_of_range exceptions from terminating noexcept functions. #37 - Validate num_externs does not exceed the total number of values before passing to xnn_create_subgraph. #39 - Validate tensor_value->num_dims() matches the actual dims array size and check dims is non-null before use. #41 - Validate buffer_idx against constant_buffer/constant_data vector sizes in getConstantDataPtr before indexing. #42 - Change flatbufferDimsToVector to return Result and reject individual dimension values exceeding 16M, preventing unbounded memory allocation from crafted inputs. This PR was authored with the assistance of Claude.
1 parent 21d9c64 commit 3217c55

1 file changed

Lines changed: 282 additions & 103 deletions

File tree

0 commit comments

Comments
 (0)