Fix Savannah bug #43547.

* src/pcf/pcfread.c (pcf_read_TOC): Check `size' and `offset'
values.
2.6.5
Werner Lemberg 10 years ago
parent f49a100a6c
commit 0e2f5d518c
  1. 7
      ChangeLog
  2. 15
      src/pcf/pcfread.c

@ -1,3 +1,10 @@
2014-11-06 Werner Lemberg <wl@gnu.org>
Fix Savannah bug #43547.
* src/pcf/pcfread.c (pcf_read_TOC): Check `size' and `offset'
values.
2014-11-06 Werner Lemberg <wl@gnu.org>
* src/pcf/pcfread.c (pcf_read_TOC): Avoid memory leak.

@ -154,6 +154,21 @@ THE SOFTWARE.
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
{

Loading…
Cancel
Save