Skip to content

Commit dfcb0ba

Browse files
committed
Refactor using code from master used to fix CORE-6385.
Fix for CORE-6466 also fixed CORE-6385 in B3_0_Release.
1 parent ebbffa7 commit dfcb0ba

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/dsql/Parser.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,7 @@ class Parser : public Firebird::PermanentStorage
191191
private:
192192
template <typename T> T* setupNode(Node* node)
193193
{
194-
// Get line/column from YYPOSNARG(1)
195-
const int posnArg = 1;
196-
node->line = ((yyps->psp)[1 - yym + posnArg - 1]).firstLine;
197-
node->column = ((yyps->psp)[1 - yym + posnArg - 1]).firstColumn;
194+
setNodeLineColumn(node);
198195
return static_cast<T*>(node);
199196
}
200197

@@ -339,6 +336,8 @@ class Parser : public Firebird::PermanentStorage
339336
void yyMoreStack(yyparsestate* yyps);
340337
yyparsestate* yyNewState(int size);
341338

339+
void setNodeLineColumn(Node* node);
340+
342341
private:
343342
int parseAux();
344343
int yylex1();

src/dsql/btyacc_fb.ske

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,17 @@ void Parser::yyFreeState(Parser::yyparsestate* p)
179179
}
180180

181181

182+
void Parser::setNodeLineColumn(Node* node)
183+
{
184+
// Check if we are not accessing the position stack below its base.
185+
if (&YYPOSNARG(1) >= yyps->ps)
186+
{
187+
node->line = YYPOSNARG(1).firstLine;
188+
node->column = YYPOSNARG(1).firstColumn;
189+
}
190+
}
191+
192+
182193
int Parser::parseAux()
183194
{
184195
// ASF: yym moved to Parser.h

0 commit comments

Comments
 (0)