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

Frontported fix for CORE-3115: Bugs in the internal record compression routines

This commit is contained in:
alexpeshkoff 2010-10-14 12:28:58 +00:00
parent 1f79aca466
commit db34472378

View File

@ -274,12 +274,12 @@ UCHAR* Compressor::unpack(size_t inLength,
if (len < 0)
{
const UCHAR c = *input++;
if ((output - len) > output_end)
if (input >= end || (output - len) > output_end)
{
BUGCHECK(179); // msg 179 decompression overran buffer
}
const UCHAR c = *input++;
memset(output, c, (-1 * len));
output -= len;
}
@ -379,7 +379,7 @@ size_t Compressor::makeDiff(size_t length1,
// when rec1 is at the end of a segment, to avoid wrapping around
const UCHAR* yellow = (UCHAR*) MIN((U_IPTR) end1, ((U_IPTR) rec1 + 127)) - 1;
while (rec1 <= yellow && (rec1[0] != rec2[0] || (rec1[1] != rec2[1] && rec1 < yellow)))
while (rec1 <= yellow && (rec1[0] != rec2[0] || (rec1 < yellow && rec1[1] != rec2[1])))
{
STUFF(*rec2++);
++rec1;