8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 20:43:02 +01:00

Fixed a few suspicious places related to the variable cloning.

This commit is contained in:
dimitr 2010-08-25 08:02:21 +00:00
parent 0c79c118cd
commit e7c44824e6

View File

@ -2066,6 +2066,21 @@ jrd_nod* NodeCopier::copy(thread_db* tdbb, jrd_nod* input)
}
return input;
case nod_init_variable:
if (csb->csb_remap_variable != 0)
{
node = PAR_make_node(tdbb, e_init_var_length);
node->nod_type = input->nod_type;
node->nod_count = input->nod_count;
USHORT n = csb->csb_remap_variable + (USHORT)(IPTR) input->nod_arg[e_init_var_id];
node->nod_arg[e_init_var_id] = (jrd_nod*)(IPTR) n;
node->nod_arg[e_init_var_variable] = input->nod_arg[e_init_var_variable];
node->nod_arg[e_init_var_info] = input->nod_arg[e_init_var_info];
return node;
}
return input;
case nod_literal:
return input;
@ -2238,11 +2253,11 @@ jrd_nod* NodeCopier::copy(thread_db* tdbb, jrd_nod* input)
*(dsc*) (node->nod_arg + e_dcl_desc) = *(dsc*) (input->nod_arg + e_dcl_desc);
csb->csb_variables =
vec<jrd_nod*>::newVector(*tdbb->getDefaultPool(), csb->csb_variables, n);
vec<jrd_nod*>::newVector(*tdbb->getDefaultPool(), csb->csb_variables, n + 1);
return node;
}
break;
return input;
case nod_dcl_cursor:
node = PAR_make_node(tdbb, e_dcl_cur_length);
@ -2690,7 +2705,7 @@ jrd_nod* CMP_pass1(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node)
{
const USHORT n = (USHORT)(IPTR) node->nod_arg[e_init_var_id];
vec<jrd_nod*>* vector = csb->csb_variables;
if (!vector || n >= vector->count() || !(node->nod_arg[e_var_variable] = (*vector)[n]))
if (!vector || n >= vector->count() || !(node->nod_arg[e_init_var_variable] = (*vector)[n]))
{
PAR_syntax_error(csb, "variable identifier");
}