Forgotten NSBrowser commit.

Fix to make ICNS loading more stable.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26993 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2008-10-31 09:53:21 +00:00
parent 2b3ec299c9
commit a6a6257800
3 changed files with 28 additions and 6 deletions

View file

@ -1,3 +1,15 @@
2008-10-31 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSBitmapImageRep+ICNS.m
(icns_get_image32_with_mask_from_family): Protect against buffer
overfow detected by valgrind.
2008-10-29 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSBrowser.m (-drawTitle:inRect:ofColumn:, -dealloc): Set
and unset the ownership of the shared title cell.
Patch by Matt Rice <ratmice@gmail.com>.
2008-10-24 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSMenu.m (-indexOfItemWithTarget:andAction:): Compare the

View file

@ -327,6 +327,7 @@ static int icns_get_image32_with_mask_from_family(icns_family_t *iconFamily,
int j;
int res;
icns_type_t mask_type;
unsigned int imageDataSize;
if (icns_types_equal(type, ICNS_NULL_TYPE))
return 1;
@ -348,6 +349,7 @@ static int icns_get_image32_with_mask_from_family(icns_family_t *iconFamily,
return 1;
}
imageDataSize = iconImage->imageDataSize;
if ((element->elementSize - ICNS_HEADER_SIZE) <
3 * iconImage->imageHeight * iconImage->imageWidth)
{
@ -364,16 +366,18 @@ static int icns_get_image32_with_mask_from_family(icns_family_t *iconFamily,
{
icns_byte_t bv = *b++;
int runLen;
unsigned int index = samplesPerPixel * offset + plane;
if (bv & 0x80)
{
// Compressed run
icns_byte_t val = *b++;
runLen = bv - 125;
for (j = 0; j < runLen; j++)
for (j = 0; (j < runLen) && (index < imageDataSize); j++)
{
iconImage->imageData[samplesPerPixel * (offset + j)
+ plane] = val;
iconImage->imageData[index] = val;
index += samplesPerPixel;
}
}
else
@ -382,10 +386,10 @@ static int icns_get_image32_with_mask_from_family(icns_family_t *iconFamily,
int j;
runLen = bv + 1;
for (j = 0; j < runLen; j++)
for (j = 0; (j < runLen) && (index < imageDataSize); j++)
{
iconImage->imageData[samplesPerPixel * (offset + j)
+ plane] = *b++;
iconImage->imageData[index] = *b++;
index += samplesPerPixel;
}
}

View file

@ -1453,6 +1453,7 @@ static NSTextFieldCell *titleCell;
if (!_isTitled || !NSBR_COLUMN_IS_VISIBLE(column))
return;
[titleCell setControlView: self];
[titleCell setStringValue: title];
[titleCell drawWithFrame: aRect inView: self];
}
@ -2258,6 +2259,11 @@ static NSTextFieldCell *titleCell;
- (void) dealloc
{
if ([titleCell controlView] == self)
{
[titleCell setControlView: nil];
}
RELEASE(_browserCellPrototype);
RELEASE(_pathSeparator);
RELEASE(_horizontalScroller);