Follow-up to #1597 (review nice-to-have #6). cpu_routing_problem::to_device validates capacity-dimension sizes but not cost/transit matrices or other array lengths. A malformed proto could pass sizes that data_model_view documents but does not hard-validate, risking out-of-bounds access on device.
Scope
- Validate shapes/lengths in
to_device (or the mapper) and return a clear INVALID_ARGUMENT instead of risking OOB:
- cost/transit matrices ==
num_locations²
- order arrays ==
num_orders; vehicle arrays == fleet_size
- pickup/delivery index bounds, break/matching/precedence indices
🤖 Generated with Claude Code
Follow-up to #1597 (review nice-to-have #6).
cpu_routing_problem::to_devicevalidates capacity-dimension sizes but not cost/transit matrices or other array lengths. A malformed proto could pass sizes thatdata_model_viewdocuments but does not hard-validate, risking out-of-bounds access on device.Scope
to_device(or the mapper) and return a clearINVALID_ARGUMENTinstead of risking OOB:num_locations²num_orders; vehicle arrays ==fleet_size🤖 Generated with Claude Code