Merge "Fix OOB read in parseInputs in ShimPreparedModel.cpp" into tm-qpr-dev
diff --git a/shim_and_sl/ShimConverter.cpp b/shim_and_sl/ShimConverter.cpp
index 2cbdc09..1ed0e31 100644
--- a/shim_and_sl/ShimConverter.cpp
+++ b/shim_and_sl/ShimConverter.cpp
@@ -128,6 +128,12 @@
switch (operand.lifetime) {
case OperandLifeTime::CONSTANT_COPY: {
+ if (operand.location.length + operand.location.offset >
+ model.operandValues.size()) {
+ *errorStatus = ErrorStatus::INVALID_ARGUMENT;
+ return nullptr;
+ }
+
if (operand.location.length <=
ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES) {
resultModel.setOperandValue(