Skip to content

Commit 1e3d29a

Browse files
committed
Fix possible buffer overruns
1 parent 921226b commit 1e3d29a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Source/NSCharacterSet.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ - (BOOL) hasMemberInPlane: (uint8_t)aPlane
188188
unsigned i = GSBITMAP_SIZE * aPlane;
189189
unsigned e = GSBITMAP_SIZE * (aPlane + 1);
190190

191+
if (e > _length)
192+
{
193+
e = _length;
194+
}
191195
while (i < e)
192196
{
193197
if (_data[i] != 0)
@@ -450,6 +454,10 @@ - (NSData*) bitmapRepresentation
450454
i--;
451455
}
452456
}
457+
else if (_length < i)
458+
{
459+
i = _length;
460+
}
453461
return [NSData dataWithBytes: _data length: i];
454462
}
455463

0 commit comments

Comments
 (0)