mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-10 02:29:43 +00:00
fix FontDirWrapper off-by-one bugs and warnings
This commit is contained in:
parent
797260262e
commit
51e6a2cf9f
|
@ -136,7 +136,7 @@ gfxPlatformMac::GetCachedDirForFont(nsString name)
|
|||
void
|
||||
gfxPlatformMac::SetCachedDirForFont(nsString name, uint8_t* table, ByteCount sizer)
|
||||
{
|
||||
if (sizer < 0 || sizer > 1024) return;
|
||||
if (MOZ_UNLIKELY(sizer < 1 || sizer > 1023)) return;
|
||||
|
||||
FontDirWrapper *k = new FontDirWrapper(sizer, table);
|
||||
PlatformFontDirCache.Put(name, k);
|
||||
|
|
|
@ -26,12 +26,12 @@ class FontDirWrapper {
|
|||
public:
|
||||
uint8_t fontDir[1024];
|
||||
ByteCount sizer;
|
||||
FontDirWrapper::FontDirWrapper(ByteCount sized, uint8_t *dir) {
|
||||
if (sized < 0 || sized > 1024) return;
|
||||
FontDirWrapper(ByteCount sized, uint8_t *dir) {
|
||||
if (MOZ_UNLIKELY(sized < 1 || sized > 1023)) return;
|
||||
sizer = sized;
|
||||
memcpy(fontDir, dir, sizer);
|
||||
}
|
||||
FontDirWrapper::~FontDirWrapper() { }
|
||||
~FontDirWrapper() { }
|
||||
};
|
||||
|
||||
class gfxPlatformMac : public gfxPlatform {
|
||||
|
|
Loading…
Reference in New Issue
Block a user