summaryrefslogtreecommitdiff
path: root/src/xmlpatterns/parser/qparsercontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlpatterns/parser/qparsercontext.cpp')
-rw-r--r--src/xmlpatterns/parser/qparsercontext.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/xmlpatterns/parser/qparsercontext.cpp b/src/xmlpatterns/parser/qparsercontext.cpp
index beb1b0b..a30f07d 100644
--- a/src/xmlpatterns/parser/qparsercontext.cpp
+++ b/src/xmlpatterns/parser/qparsercontext.cpp
@@ -88,5 +88,29 @@ void ParserContext::finalizePushedVariable(const int amount,
}
}
+void ParserContext::handleStackOverflow(const char *, short **yyss, size_t,
+ TokenValue **yyvs, size_t,
+ YYLTYPE **yyls, size_t,
+ size_t *yystacksize)
+{
+ bool isFirstTime = parserStack_yyvs.isEmpty();
+ Q_ASSERT(*yystacksize < INT_MAX - 50);
+ int new_yystacksize = static_cast<int>(*yystacksize) + 50;
+ parserStack_yyss.resize(new_yystacksize);
+ parserStack_yyvs.resize(new_yystacksize);
+ parserStack_yyls.resize(new_yystacksize);
+ if (isFirstTime) {
+ for (int i = 0, ei = static_cast<int>(*yystacksize); i != ei; ++i) {
+ parserStack_yyss[i] = (*yyss)[i];
+ parserStack_yyvs[i] = (*yyvs)[i];
+ parserStack_yyls[i] = (*yyls)[i];
+ }
+ }
+ *yyss = parserStack_yyss.data();
+ *yyvs = parserStack_yyvs.data();
+ *yyls = parserStack_yyls.data();
+ *yystacksize = new_yystacksize;
+}
+
QT_END_NAMESPACE