Views
No views yet
.xml + .bin)set_constant_num_buffer() calls the unsafe ov::shape_size() overload
(std::accumulate + std::multiplies, no overflow check) on attacker-controlled
shape values. The safe shape_size_safe() (with mul_overflow per step)
exists in the same codebase but is only used by allocate_buffer().src/core/xml_util/src/xml_deserialize_util.cpp1// UNSAFE — no overflow check:
2if (size < ((ov::shape_size(shape) * el_type.bitwidth() + 7) >> 3))
3 throw ...;
4// If shape_size() overflows to 0, check becomes: if (size < 0) → false → BYPASSED1// shape_util.cpp — shape_size_safe():
2if (mul_overflow(size, *first, size)) return std::nullopt;[4611686018427387904, 4] (2^62 × 4):ov::shape_size() overflows signed int64 → UB, typically wraps to 04 < (0 * 32 + 7) >> 3 → 4 < 0 → false → check bypassed| File | Location | Issue |
|---|---|---|
src/core/xml_util/src/xml_deserialize_util.cpp | set_constant_num_buffer() | Calls unsafe ov::shape_size() on attacker shape |
src/core/include/openvino/core/shape.hpp | shape_size() | std::accumulate + std::multiplies, no overflow check |
src/core/src/shape_util.cpp | shape_size_safe() | Safe version — NOT called here |
poc_openvino_int_overflow.py — builds crafted IR and triggers bypass + OOBpoc_overflow_patterns.py — tests multiple overflow shapes systematically1pip install openvino
2python poc_openvino_int_overflow.pyset_constant_num_buffer():1// Replace:
2ov::shape_size(shape)
3// With:
4ov::shape_size_safe(shape).value_or(throw ov::Exception("Shape overflow"))