diff options
author | Kevin May <kevin.may@arm.com> | 2023-07-06 14:34:35 +0100 |
---|---|---|
committer | Kevin May <kevin.may@arm.com> | 2023-07-06 14:34:35 +0100 |
commit | 8e9747ab5211460e8dcc5e81d97e567152a0b710 (patch) | |
tree | 6e68a28ab70284b14a44c25504809fe9b948902f /shim | |
parent | 4a54daadf070c96a481f0da0241a5981b849a0ee (diff) | |
download | armnn-8e9747ab5211460e8dcc5e81d97e567152a0b710.tar.gz |
IVGCVSW-7848 Add cache size check to Support Library
* Fix for 2 VTS tests named CacheSavingAndRetrievalNonZeroOffset
Signed-off-by: Kevin May <kevin.may@arm.com>
Change-Id: Id8e02b6383be5706311583aab3f507b5bb43c0bb
Diffstat (limited to 'shim')
-rw-r--r-- | shim/sl/canonical/ArmnnDriverImpl.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/shim/sl/canonical/ArmnnDriverImpl.cpp b/shim/sl/canonical/ArmnnDriverImpl.cpp index 0f7888bb4b..060dd5a252 100644 --- a/shim/sl/canonical/ArmnnDriverImpl.cpp +++ b/shim/sl/canonical/ArmnnDriverImpl.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -400,6 +400,11 @@ GeneralResult<SharedPreparedModel> ArmnnDriverImpl::PrepareArmnnModelFromCache( pread(*dataCacheHandle[0], hashValue.data(), hashValue.size(), 0); // Read the model + if (cachedDataSize < hashValue.size()) + { + return NN_ERROR(ErrorStatus::GENERAL_FAILURE) + << "ArmnnDriverImpl::prepareModelFromCache(): cachedDataSize is less than hashValue!"; + } std::vector<uint8_t> dataCacheData(cachedDataSize - hashValue.size()); pread(*dataCacheHandle[0], dataCacheData.data(), dataCacheData.size(), hashValue.size()); auto calculatedHashValue = Hash(dataCacheData); |