From Mathias Froehlich, "While tracking some valgrind problems in flightgear, I found a remaining off by

one error in the rgb loader.

Previously we limited the current line to the image with + 1. With that change
it is correctly limited to the width of the image.
Also flightgear seems to run nice with that change.
"
This commit is contained in:
Robert Osfield 2010-06-01 11:51:37 +00:00
parent 054d5606fb
commit c05330089d

View File

@ -302,9 +302,9 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z)
count = (int)(pixel & 0x7F);
// limit the count value to the remiaing row size
if (oPtr + count*raw->bpc > buf + raw->sizeX*raw->bpc)
if (raw->sizeX*raw->bpc <= (oPtr - buf))
{
count = ( (buf + raw->sizeX*raw->bpc) - oPtr ) / raw->bpc;
count = raw->sizeX - (oPtr - buf) / raw->bpc;
}
if (count<=0)