[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] parthw-pk-vf 5f57c6a: [pk] Improve error checking in font fi
From: |
Parth Wazurkar |
Subject: |
[freetype2] parthw-pk-vf 5f57c6a: [pk] Improve error checking in font file. |
Date: |
Fri, 13 Jul 2018 12:59:55 -0400 (EDT) |
branch: parthw-pk-vf
commit 5f57c6a8e8556d9ca995de3b34109508a849fbae
Author: Parth Wazurkar <address@hidden>
Commit: Parth Wazurkar <address@hidden>
[pk] Improve error checking in font file.
* src/pk/pklib.c (pk_load_font): Add check for
`PK_ID' and `PK_PRE' command in the font file.
---
src/pk/pklib.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/pk/pklib.c b/src/pk/pklib.c
index eecf77d..b612563 100644
--- a/src/pk/pklib.c
+++ b/src/pk/pklib.c
@@ -287,7 +287,7 @@ unsigned char bit_table[] = {
PK_Glyph *goptr )
{
PK_Glyph go;
- UINT1 instr;
+ UINT1 instr, pre, id;;
UINT4 ds, check_sum, hppp, vppp, k;
unsigned int flag, dny_f, bw, ess, size;
UINT4 cc, tfm, dx, dy, dm, w, h, rs;
@@ -300,6 +300,25 @@ unsigned char bit_table[] = {
go = NULL;
nchars = -1;
+ if( FT_STREAM_SEEK( 0 ) )
+ goto Exit;
+
+ pre = READ_UINT1( stream );
+ if (pre != PK_PRE)
+ {
+ FT_ERROR(( "pk_load_font: missing PK_PRE(247) field\n" ));
+ error = FT_THROW( Unknown_File_Format );
+ goto Exit;
+ }
+
+ id = READ_UINT1( stream );
+ if (id != PK_ID)
+ {
+ FT_ERROR(( "pk_load_font: missing PK_ID(89) field\n" ));
+ error = FT_THROW( Unknown_File_Format );
+ goto Exit;
+ }
+
k = READ_UINT1( stream );
if ( FT_STREAM_SKIP( k ) )
goto Exit;
@@ -469,6 +488,7 @@ unsigned char bit_table[] = {
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
+
index = cc - go->code_min;
go->bm_table[index].bbx_width = w;
go->bm_table[index].bbx_height = h;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] parthw-pk-vf 5f57c6a: [pk] Improve error checking in font file.,
Parth Wazurkar <=