Views
No views yet
InputDims::from_string out-of-bounds index panic152ac2d508f1bae9ee62c46b7d211d80e40a6425modules/core/src/storage/header/input_dims.rsInputDims::from_string()36 — dims: [dims[0], dims[1]] — panics when dims.len() < 2InputDims::from_string() splits the input-dims header field on ,, collects results into a Vec, then unconditionally indexes dims[0] and dims[1]. If the field contains fewer than two comma-separated integers (e.g. "1"), dims.len() == 1 and dims[1] panics with index out of bounds. A second panic site exists at the parse::<i32>().unwrap() call — any non-numeric token also aborts. A 45-byte crafted file reliably triggers the OOB panic.| File | Description |
|---|---|
poc_bug04.surml | 45-byte malicious .surml triggering the panic |
generate_poc_bug04.py | Python script that generates the PoC |
BUG04-actual-log.txt | Actual panic output + full stack backtrace |
BUG04-verdict.md | Full verdict with source analysis |
1python3 generate_poc_bug04.py
2# produces poc_bug04.surml (45 bytes)1use surrealml_core::storage::surml_file::SurMlFile;
2let _ = SurMlFile::from_file("poc_bug04.surml");RUST_BACKTRACE=1 cargo run -- poc_bug04.surmlthread 'main' panicked at modules/core/src/storage/header/input_dims.rs:36:33:
index out of bounds: the len is 1 but the index is 1
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic_bounds_check
3: <usize as core::slice::index::SliceIndex<[T]>>::index
4: core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
5: <alloc::vec::Vec<T,A> as core::ops::index::Index<I>>::index
6: surrealml_core::storage::header::input_dims::InputDims::from_string
at modules/core/src/storage/header/input_dims.rs:36:33
7: surrealml_core::storage::header::Header::from_bytes
at modules/core/src/storage/header/mod.rs:190:26
8: surrealml_core::storage::surml_file::SurMlFile::from_file
at modules/core/src/storage/surml_file.rs:124:22
EXIT: 101.surml.parse().unwrap() before it.SurMlFile::from_file(), SurMlFile::from_bytes(), and the load_model() C FFI.152ac2d508f1bae9ee62c46b7d211d80e40a6425poc_bug04.surml
a2cb664a6fbed4a5a70decb91343a9bbf377f6de25b5eb4e1d0a2c700064a447