Skip to content

Commit e65ff91

Browse files
tools: plugin: ov_noise_suppression: validate model input shape dimensions
noise_suppression_load_model() and noise_suppression_first_iter() take the input tensor shape directly from the OpenVINO model file via nd->model->input(...).get_shape() and feed the resulting dimensions into downstream size computations and allocations without any range check. A crafted or corrupted .xml/.bin model can specify dimensions that are either zero (producing zero-sized allocations later written into) or large enough that a subsequent multiplication overflows before being used as a buffer length. Both lead to out-of-bounds memory access at inference time. The same pattern exists for the per-iteration input state shape, which is also read from the model. After fetching each shape, walk its dimensions and reject the model with -EINVAL if any dimension is zero or exceeds 1 << 24 (16 Mi elements). The upper bound is well above any realistic noise suppression tensor dimension and well below the point at which a product of two such dimensions can overflow a 32-bit size on the platforms this plugin targets, which closes the integer-overflow path without rejecting valid models. No functional change for well-formed models; malformed models now fail the load instead of corrupting memory. Reported-by: OrbisAI Security scanner (V-004, CWE-190) Signed-off-by: OrbisAI Security <mediratta01.pally@gmail.com>
1 parent 9cd055b commit e65ff91

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tools/plugin/modules/ov_noise_suppression/noise_suppression_interface.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ extern "C" {
8585
nd->infer_request[i] = compiled_model.create_infer_request();
8686

8787
nd->inp_shape = nd->model->input("input").get_shape();
88+
for (auto dim : nd->inp_shape)
89+
if (!dim || dim > (1u << 24))
90+
return -EINVAL;
8891

8992
return 0;
9093
}
@@ -141,6 +144,9 @@ extern "C" {
141144
ov::Shape state_shape;
142145

143146
state_shape = nd->model->input(inp_state_name).get_shape();
147+
for (auto dim : state_shape)
148+
if (!dim || dim > (1u << 24))
149+
return -EINVAL;
144150
if (nd->iter > 0) {
145151
/*
146152
* set input state by corresponding output state from prev

0 commit comments

Comments
 (0)