Merge "Fix OOB Read in convertSubgraphFromHAL"
diff --git a/shim_and_sl/ShimConverter.cpp b/shim_and_sl/ShimConverter.cpp
index 46a05ab..ed3cda2 100644
--- a/shim_and_sl/ShimConverter.cpp
+++ b/shim_and_sl/ShimConverter.cpp
@@ -132,6 +132,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(