Skip to content

Commit c2b5ac9

Browse files
committed
add bounds check
1 parent 8ceb60b commit c2b5ac9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.github/workflows/selfcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
122122
- name: Self check (unusedFunction / no test / no gui)
123123
run: |
124-
supprs="--suppress=unusedFunction:lib/errorlogger.h:193 --suppress=unusedFunction:lib/importproject.cpp:1516 --suppress=unusedFunction:lib/importproject.cpp:1540"
124+
supprs="--suppress=unusedFunction:lib/errorlogger.h:193 --suppress=unusedFunction:lib/importproject.cpp:1518 --suppress=unusedFunction:lib/importproject.cpp:1542"
125125
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib -D__CPPCHECK__ -D__GNUC__ --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest_nogui/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr $supprs
126126
env:
127127
DISABLE_VALUEFLOW: 1

lib/importproject.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ void ImportProject::fsParseCommand(FileSettings& fs, const std::string& command,
270270
if (command[pos] == '"') {
271271
wholeArgQuoted = true;
272272
pos++;
273+
if (pos >= command.size())
274+
break;
273275
}
274276
if (command[pos] != '/' && command[pos] != '-')
275277
continue;

0 commit comments

Comments
 (0)