Skip to main content

fuzz_read_sql_bytes

Function fuzz_read_sql_bytes 

Source
pub fn fuzz_read_sql_bytes(input: &[u8]) -> Result<(), String>
Expand description

Structure-aware fuzz entrypoint for SQL read APIs against an in-memory SQLite connection.

Per br-frankenpandas-gpxk Phase 1: fp-io exposes six pub fns that accept untrusted query strings (read_sql, read_sql_with_options, read_sql_with_index_col, read_sql_table, read_sql_table_with_index_col, read_sql_table_columns). This target keeps the narrow query parser path covered while also dispatching into the indexed read variants, where index_col validation has separate edge cases.

Harness shape:

  • Construct a fixed-schema in-memory SQLite (two small tables populated with deterministic rows).
  • Convert input bytes to lossy UTF-8, clamp to 4 KB. Legacy corpus entries are interpreted entirely as SQL/table text; inputs prefixed with [0xff, mode] use mode for API/index_col dispatch and the remaining bytes as SQL/table text.
  • Call one SQL read entrypoint; Ok and Err are both acceptable, panics are not. Successful frames must preserve column/index length invariants.