From faa8162a2ba01cc81ec41becedcc1dc687a3c59e Mon Sep 17 00:00:00 2001 From: dimitr Date: Thu, 25 Aug 2005 12:37:26 +0000 Subject: [PATCH] Fixed SEGV reported by Konstantin. --- src/dsql/pass1.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/dsql/pass1.cpp b/src/dsql/pass1.cpp index dd9bd51bb0..7140db362d 100644 --- a/src/dsql/pass1.cpp +++ b/src/dsql/pass1.cpp @@ -931,13 +931,15 @@ dsql_nod* PASS1_node(dsql_req* request, dsql_nod* input, bool proc_flag) case nod_current_timestamp: { dsql_nod* const_node = input->nod_arg[0]; - fb_assert(const_node->nod_type == nod_constant); - const int precision = (int)(IPTR) const_node->nod_arg[0]; - fb_assert(precision >= 0); - // We pass precision as a single byte, hence a check - // to avoid overflows - if (precision > MAX_UCHAR) { - const_node->nod_arg[0] = (dsql_nod*)(IPTR) MAX_UCHAR; + if (const_node) { + fb_assert(const_node->nod_type == nod_constant); + const int precision = (int)(IPTR) const_node->nod_arg[0]; + fb_assert(precision >= 0); + // We pass precision as a single byte, hence a check + // to avoid overflows + if (precision > MAX_UCHAR) { + const_node->nod_arg[0] = (dsql_nod*)(IPTR) MAX_UCHAR; + } } } break;