8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 18:03:02 +01:00

Backport fix for CORE-2739 - ASSERT at parse.cpp line 22885

This commit is contained in:
asfernandes 2009-11-07 19:21:03 +00:00
parent 1a1c013496
commit ee1e7aa529
3 changed files with 9 additions and 9 deletions

View File

@ -21,6 +21,7 @@
*/
#include "firebird.h"
#include <ctype.h>
#include "../dsql/Parser.h"
#include "../jrd/jrd.h"
@ -123,17 +124,20 @@ void Parser::transformString(const char* start, unsigned length, string& dest)
const char* s = lex.start + mark.pos;
buffer.add(pos, s - pos);
if (!isspace(UCHAR(pos[s - pos - 1])))
buffer.add(' '); // fix _charset'' becoming invalid syntax _charsetX''
const size_t count = buffer.getCount();
const size_t newSize = count + 2 + mark.textLength * 2 + 1;
const size_t newSize = count + 2 + mark.str->str_length * 2 + 1;
buffer.grow(newSize);
char* p = buffer.begin() + count;
*p++ = 'X';
*p++ = '\'';
const char* s2 = lex.start + mark.textPos;
const char* s2 = mark.str->str_data;
for (const char* end = lex.start + mark.textPos + mark.textLength; s2 < end; ++s2)
for (const char* end = s2 + mark.str->str_length; s2 < end; ++s2)
{
*p++ = HEX_DIGITS[UCHAR(*s2) >> 4];
*p++ = HEX_DIGITS[UCHAR(*s2) & 0xF];

View File

@ -91,8 +91,7 @@ private:
{
unsigned pos;
unsigned length;
unsigned textPos;
unsigned textLength;
dsql_str* str;
};
public:

View File

@ -4422,10 +4422,7 @@ sql_string
IntroducerMark mark;
mark.pos = lex.last_token - lex.start;
mark.length = lex.ptr - lex.last_token;
mark.textLength = str->str_length;
fb_assert(mark.length - mark.textLength == 2);
mark.textPos = mark.pos + 1;
mark.str = str;
introducerMarks.push(mark);
}