psaux: Prevent invalid arguments to afm_parser_read_vals().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
diff --git a/ChangeLog b/ChangeLog
index 2069c19..38ad799 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2009-07-31 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+ psaux: Prevent invalid arguments to afm_parser_read_vals().
+
+ * src/psaux/afmparse.c (afm_parser_read_vals): Change
+ the type of `n' to prevent negative number how many
+ arguments should be parsed.
+
+ * src/psaux/afmparse.h (afm_parser_read_vals): Ditto.
+
+2009-07-31 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
base: Prevent some overflows on LP64 systems.
* src/base/ftadvance.c (FT_Get_Advances): Cast the
diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c
index 0a0f249..44fe42f 100644
--- a/src/psaux/afmparse.c
+++ b/src/psaux/afmparse.c
@@ -366,11 +366,11 @@
FT_LOCAL_DEF( FT_Int )
afm_parser_read_vals( AFM_Parser parser,
AFM_Value vals,
- FT_Int n )
+ FT_UInt n )
{
AFM_Stream stream = parser->stream;
char* str;
- FT_Int i;
+ FT_UInt i;
if ( n > AFM_MAX_ARGUMENTS )
diff --git a/src/psaux/afmparse.h b/src/psaux/afmparse.h
index c2fce75..7772dc7 100644
--- a/src/psaux/afmparse.h
+++ b/src/psaux/afmparse.h
@@ -71,7 +71,7 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Int )
afm_parser_read_vals( AFM_Parser parser,
AFM_Value vals,
- FT_Int n );
+ FT_UInt n );
/* read the next key from the next line or column */
FT_LOCAL( char* )