From d5b57012bd98a0e530aa64650fcb5a521998234a Mon Sep 17 00:00:00 2001 From: Giacomo Tazzari Date: Thu, 31 Jul 2014 21:39:30 +0200 Subject: [PATCH 1/2] Fixed a bug in treefy() that tried to access vector oq before making sure it's not empty --- libserpent/parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libserpent/parser.cpp b/libserpent/parser.cpp index 38fdca6ed..497bdb526 100644 --- a/libserpent/parser.cpp +++ b/libserpent/parser.cpp @@ -150,10 +150,10 @@ Node treefy(std::vector stream) { else if (typ == RPAREN) { std::vector args; while (1) { + if (!oq.size()) err("Bracket without matching", tok.metadata); if (toktype(oq.back()) == LPAREN) break; args.push_back(oq.back()); oq.pop_back(); - if (!oq.size()) err("Bracket without matching", tok.metadata); } oq.pop_back(); args.push_back(oq.back()); From edd47b3cf54c28de72fb13d6da57c54eb35777de Mon Sep 17 00:00:00 2001 From: Giacomo Tazzari Date: Thu, 31 Jul 2014 21:58:24 +0200 Subject: [PATCH 2/2] Added another bound check in on_debugStep_triggered() to prevent the debugger from trying to move forward (e.g. if you hit F10) in case we are already at the end --- alethzero/MainWin.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index a384f2fcb..3ca3b1be3 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -1517,15 +1517,17 @@ void Main::on_create_triggered() void Main::on_debugStep_triggered() { - auto l = m_history[ui->debugTimeline->value()].levels.size(); - if ((ui->debugTimeline->value() + 1) < m_history.size() && m_history[ui->debugTimeline->value() + 1].levels.size() > l) - { - on_debugStepInto_triggered(); - if (m_history[ui->debugTimeline->value()].levels.size() > l) - on_debugStepOut_triggered(); + if (ui->debugTimeline->value() < m_history.size()) { + auto l = m_history[ui->debugTimeline->value()].levels.size(); + if ((ui->debugTimeline->value() + 1) < m_history.size() && m_history[ui->debugTimeline->value() + 1].levels.size() > l) + { + on_debugStepInto_triggered(); + if (m_history[ui->debugTimeline->value()].levels.size() > l) + on_debugStepOut_triggered(); + } + else + on_debugStepInto_triggered(); } - else - on_debugStepInto_triggered(); } void Main::on_debugStepInto_triggered()