summaryrefslogtreecommitdiff
path: root/cpu_ref/rsCpuExecutable.cpp
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2017-12-12 09:24:37 -0800
committerIvan Lozano <ivanlozano@google.com>2017-12-19 15:22:18 -0800
commit90016ca95e9e13a2bac15767ebc2b6a9b947cb94 (patch)
tree442c358f67bbd1d54518e50617a52d2e92adbb21 /cpu_ref/rsCpuExecutable.cpp
parent846639747108940f3612a1aad63797fe8671a8ec (diff)
downloadrs-90016ca95e9e13a2bac15767ebc2b6a9b947cb94.tar.gz
Fix createFromSharedObject in sanitized builds.
On integer sanitized builds, a runtime error occurs on the last loop of the while loop. runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned int') This restructures the while loop to prevent the overflow from occurring. Bug: 30969751 Test: Compiles, device boots. Ran RS tests. Change-Id: I11a3f9299e8fa376abfa63eca8baa6a186f787a1 Merged-In: I11a3f9299e8fa376abfa63eca8baa6a186f787a1
Diffstat (limited to 'cpu_ref/rsCpuExecutable.cpp')
-rw-r--r--cpu_ref/rsCpuExecutable.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/cpu_ref/rsCpuExecutable.cpp b/cpu_ref/rsCpuExecutable.cpp
index 3c62d05c..12ec9088 100644
--- a/cpu_ref/rsCpuExecutable.cpp
+++ b/cpu_ref/rsCpuExecutable.cpp
@@ -747,7 +747,8 @@ ScriptExecutable* ScriptExecutable::createFromSharedObject(
goto error;
} else {
// skip the versionInfo packet as libRs doesn't use it
- while (nLines--) {
+ while (nLines) {
+ --nLines;
if (strgets(line, MAXLINE, &rsInfo) == nullptr)
goto error;
}