[Openmp-commits] [PATCH] D60471: Fixed possible out of bound array access
Andrey Churbanov via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Apr 9 10:19:39 PDT 2019
AndreyChurbanov created this revision.
AndreyChurbanov added reviewers: jlpeyton, hbae, tlwilmar.
AndreyChurbanov added a project: OpenMP.
Herald added subscribers: openmp-commits, jdoerfert.
The check of index moved to before the write to array.
Repository:
rOMP OpenMP
https://reviews.llvm.org/D60471
Files:
runtime/src/kmp_settings.cpp
Index: runtime/src/kmp_settings.cpp
===================================================================
--- runtime/src/kmp_settings.cpp
+++ runtime/src/kmp_settings.cpp
@@ -4462,10 +4462,10 @@
pos = input;
components[level++] = pos;
while ((pos = strchr(pos, ','))) {
+ if (level >= MAX_T_LEVEL)
+ goto err; // too many components provided
*pos = '\0'; // modify input and avoid more copying
components[level++] = ++pos; // expect something after ","
- if (level > MAX_T_LEVEL)
- goto err; // too many components provided
}
// Check each component
for (int i = 0; i < level; ++i) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60471.194359.patch
Type: text/x-patch
Size: 627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190409/a523ed64/attachment.bin>
More information about the Openmp-commits
mailing list