From 6141507d5a13c4958e429dd65f6cd28c6e8dabe8 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 14 Jun 2015 03:14:41 +0100 Subject: Fix off by one error in rowstack --- project2/common/execContext.cpp | 2 +- project2/sql/sqlMergeTask.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/project2/common/execContext.cpp b/project2/common/execContext.cpp index 462de8b..bbec92a 100644 --- a/project2/common/execContext.cpp +++ b/project2/common/execContext.cpp @@ -50,7 +50,7 @@ ExecContext::RowValuesPop() const RowState * ExecContext::RowValues(size_t depth) const { - if (depth > rowValuesStack.size()) { + if (depth < 1 || depth > rowValuesStack.size()) { throw RowSet::ParentOutOfRange(depth); } return rowValuesStack.at(rowValuesStack.size() - depth); diff --git a/project2/sql/sqlMergeTask.cpp b/project2/sql/sqlMergeTask.cpp index 54d4baf..91bf3e0 100644 --- a/project2/sql/sqlMergeTask.cpp +++ b/project2/sql/sqlMergeTask.cpp @@ -276,7 +276,7 @@ class Populate : public NoOutputExecute { void execute(ExecContext * ec) const { unsigned int idx = 0; - ec->RowValues(0)->foreachColumn(ec, boost::bind(&Populate::bind, this, boost::ref(idx), _3)); + ec->RowValues(1)->foreachColumn(ec, boost::bind(&Populate::bind, this, boost::ref(idx), _3)); cmd->execute(); } private: -- cgit v1.2.3