Skip to content

Commit 9b6915f

Browse files
Copilothariharans29
andcommitted
Fix out-of-bounds read vulnerability in ArrayFeatureExtractor
Co-authored-by: hariharans29 <9969784+hariharans29@users.noreply.github.com>
1 parent 9d8fc43 commit 9b6915f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

onnxruntime/core/providers/cpu/ml/array_feature_extractor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ common::Status ArrayFeatureExtractorOp<T>::Compute(OpKernelContext* context) con
7676
if (y_data[i] < 0 || y_data[i] >= stride) {
7777
return ORT_MAKE_STATUS(
7878
ONNXRUNTIME, INVALID_ARGUMENT,
79-
"Invalid Y argument: index is out of range: Y[", i, "] (", y_data[i], ") must be in [0,", stride, ")");
79+
"Invalid Y argument: index is out of range: Y[", i, "] (", y_data[i], ") must be in [0, ", stride, ")");
8080
}
8181
}
8282

onnxruntime/test/providers/cpu/ml/array_feature_extractor_test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ TEST_F(ArrayFeatureExtractorTest, InvalidInputOutOfBoundsY) {
112112
TEST_F(ArrayFeatureExtractorTest, InvalidInputNegativeY) {
113113
test_.AddInput<int64_t>("X", {10, 1}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
114114
test_.AddInput<int64_t>("Y", {1}, {-10});
115+
// Should fail due to negative index -10
115116
test_.AddOutput<int64_t>("Z", {0}, {});
116117
test_.Run(OpTester::ExpectResult::kExpectFailure);
117118
}

0 commit comments

Comments
 (0)