diff options
author | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2009-07-03 18:01:35 +0900 |
---|---|---|
committer | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2009-07-03 18:01:35 +0900 |
commit | a72a4bd3b75e231c854c1fdc1ae0e06aaeeb3e76 (patch) | |
tree | 248cdb73b720576ee84f1f321ca1421d4cf79120 | |
parent | 34bc30a5f0b3a25d0a68a42bebcb065ab01a517a (diff) | |
download | freetype2-a72a4bd3b75e231c854c1fdc1ae0e06aaeeb3e76.tar.gz |
truetype: Check invalid function number in FDEF instruction.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/truetype/ttinterp.c | 12 |
2 files changed, 17 insertions, 2 deletions
@@ -1,5 +1,12 @@ 2009-07-03 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + truetype: Check invalid function number in FDEF instruction. + + * src/truetype/ttinterp.c (Ins_FDEF): Check + if the operand fits 16-bit function number. + +2009-07-03 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + truetype: Truncate the deltas of composite glyph at 16-bit values. * src/truetype/ttgload.c (load_truetype_glyph): diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index e6a0700a4..816d1dad4 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -4290,13 +4290,21 @@ CUR.numFDefs++; } + /* Although FDEF takes unsigned 32-bit integer, */ + /* func # must be within unsigned 16-bit integer */ + if ( n > 0xFFFFU ) + { + CUR.error = TT_Err_Too_Many_Function_Defs; + return; + } + rec->range = CUR.curRange; - rec->opc = n; + rec->opc = (FT_UInt16)n; rec->start = CUR.IP + 1; rec->active = TRUE; if ( n > CUR.maxFunc ) - CUR.maxFunc = n; + CUR.maxFunc = (FT_UInt16)n; /* Now skip the whole function definition. */ /* We don't allow nested IDEFS & FDEFs. */ |