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

Fix SF field-test #1439268 - Sequence of commands crash FB server

This commit is contained in:
asfernandes 2006-03-04 18:24:04 +00:00
parent 3c4522c55f
commit fa5b4613cb
2 changed files with 8 additions and 3 deletions

View File

@ -115,10 +115,12 @@ const USHORT DPM_other = 3; /* Independent (or don't care) record */
class Record : public pool_alloc_rpt<SCHAR, type_rec>
{
public:
MemoryPool& rec_pool; // pool where record to be expanded
Record(MemoryPool& p) : rec_pool(p), rec_precedence(p) { }
const Format* rec_format; /* what the data looks like */
// ASF: Record is memcopied in VIO_record, starting at rec_format.
// rec_precedence has destructor, so don't move it to after rec_format.
MemoryPool& rec_pool; // pool where record to be expanded
PageStack rec_precedence; /* stack of higher precedence pages */
const Format* rec_format; /* what the data looks like */
USHORT rec_length; /* how much there is */
const Format* rec_fmt_bk; // backup format to cope with Borland's ill null signaling
UCHAR rec_flags; /* misc record flags */

View File

@ -2438,7 +2438,10 @@ Record* VIO_record(thread_db* tdbb, record_param* rpb, const Format* format,
{
record = FB_NEW_RPT(rpb->rpb_record->rec_pool, format->fmt_length)
Record(rpb->rpb_record->rec_pool);
memcpy(record, rpb->rpb_record, sizeof(Record) + sizeof(SCHAR) * rpb->rpb_record->rec_length);
record->rec_precedence.takeOwnership(rpb->rpb_record->rec_precedence);
// start copying at rec_format, to not mangle record->rec_precedence
memcpy(&record->rec_format, &rpb->rpb_record->rec_format,
sizeof(Record) - ((UCHAR*)&record->rec_format - (UCHAR*)record) + rpb->rpb_record->rec_length);
delete rpb->rpb_record;
rpb->rpb_record = record;
}