The GitHub Actions job "CI" on tvm-ffi.git/tvm-ffi-harden-serialization has 
failed.
Run started by GitHub user tqchen (triggered by tqchen).

Head commit for run:
ba9667da0007de9107ac8e5fe3533d58dcaa69ea / tqchen <[email protected]>
[Security][EXTRA] Harden FromJSONGraph against malformed input

The object-graph deserializer (FromJSONGraph) trusted several values
taken directly from the input JSON, which let a malformed or adversarial
graph trigger out-of-bounds reads, a stack overflow, or a segfault
instead of a clean error.

Hardening in src/ffi/extra/serialization.cc:

- Validate every node index (root_index and all child/key/value/field
  references) against the nodes array before indexing into the
  decoded_nodes_ std::vector. Previously a negative index segfaulted in
  GetOrDecodeNode and an out-of-range index read past the vector end.
- Add a recursion-depth guard so a deeply nested graph or a long chain
  of node references throws rather than overflowing the C++ stack;
  this also makes a self-referential node terminate by throwing.
- Require Device data to be exactly [device_type, device_id].
- Require Map/Dict data to have an even number of [key, value] entries
  so the inner loop cannot read one element past the end.

All previously-trusted indices, sizes, kinds and keys now throw an
ffi::Error (ValueError / TypeError / KeyError / IndexError) before any
unsafe access. Type-key, missing-key, and wrong-value-type cases were
already routed through checked accessors and continue to throw.

Tests:

- tests/cpp/extra/test_serialization.cc: a battery of crafted malformed
  graphs (out-of-range / negative indices, odd-length map data, wrong
  device arity, unknown type keys, missing keys, wrong value types,
  non-object nodes, truncated JSON, deeply nested input, self-cycle),
  each asserted to throw. The C++ test target builds with
  AddressSanitizer; the full suite passes clean.
- tests/python/test_serialization.py: the same cases at the Python
  boundary, each asserted to raise.

Report URL: https://github.com/apache/tvm-ffi/actions/runs/27284468868

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to