ref: 0e2f5d518c60e2978f26400d110eff178fa7e3c3
parent: f49a100a6c4b7e30f55b0b9867ea4255c144658c
author: Werner Lemberg <[email protected]>
date: Thu Nov 6 17:32:46 EST 2014
Fix Savannah bug #43547. * src/pcf/pcfread.c (pcf_read_TOC): Check `size' and `offset' values.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2014-11-06 Werner Lemberg <[email protected]>
+ Fix Savannah bug #43547.
+
+ * src/pcf/pcfread.c (pcf_read_TOC): Check `size' and `offset'
+ values.
+
+2014-11-06 Werner Lemberg <[email protected]>
+
* src/pcf/pcfread.c (pcf_read_TOC): Avoid memory leak.
2014-11-03 Infinality <[email protected]>
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -154,6 +154,21 @@
break;
}
+ /* we now check whether the `size' and `offset' values are reasonable: */
+ /* `offset' + `size' must not exceed the stream size */
+ tables = face->toc.tables;
+ for ( n = 0; n < toc->count; n++ )
+ {
+ /* we need two checks to avoid overflow */
+ if ( ( tables->size > stream->size ) ||
+ ( tables->offset > stream->size - tables->size ) )
+ {
+ error = FT_THROW( Invalid_Table );
+ goto Exit;
+ }
+ tables++;
+ }
+
#ifdef FT_DEBUG_LEVEL_TRACE
{