summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/preprocessor.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-09 13:59:07 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-09 13:59:07 +0200
commit0963be63ce741ef6c7585358c3f3b1cb806b66e8 (patch)
tree6f4964c196b8a52cb15e9efc0388b6a549574460 /src/tools/moc/preprocessor.cpp
parent9e6a1351823b3ee3d7e380248f6ef42ff383b014 (diff)
parenteacfbbf64ef90dad8c5cb6b2c812ad64c1100779 (diff)
Merge remote-tracking branch 'qt/dev' into dev-highdpi
Conflicts: src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface_p.h src/plugins/platforms/xcb/qxcbwindow.cpp Change-Id: Icd887552ade61d6a2b2527383970f7145aa00faf
Diffstat (limited to 'src/tools/moc/preprocessor.cpp')
-rw-r--r--src/tools/moc/preprocessor.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 51873033c7..f253c49995 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -661,8 +661,10 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
expansion += s;
}
} else if (mode == Hash) {
- if (index < 0)
+ if (index < 0 || index >= arguments.size()) {
that->error("'#' is not followed by a macro parameter");
+ continue;
+ }
const Symbols &arg = arguments.at(index);
QByteArray stringified;
@@ -681,7 +683,7 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
expansion.pop_back();
Symbol next = s;
- if (index >= 0) {
+ if (index >= 0 && index < arguments.size()) {
const Symbols &arg = arguments.at(index);
if (arg.size() == 0) {
mode = Normal;
@@ -703,7 +705,7 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
expansion += next;
}
- if (index >= 0) {
+ if (index >= 0 && index < arguments.size()) {
const Symbols &arg = arguments.at(index);
for (int i = 1; i < arg.size(); ++i)
expansion += arg.at(i);