From d9145241fe378104ba4c12a42534549faacc92e6 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Fri, 5 Feb 2010 02:58:24 +0900 Subject: [PATCH] Prevent NULL pointer dereference passed to FT_Module_Requester. --- ChangeLog | 10 ++++++++++ src/cff/cffdrivr.c | 5 +++-- src/psnames/psmodule.c | 3 +-- src/sfnt/sfdriver.c | 2 -- src/truetype/ttdriver.c | 5 +++-- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2dea8f1d..f02fc703f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-02-04 suzuki toshiya + + Prevent NULL pointer dereference passed to FT_Module_Requester. + + * src/sfnt/sfdriver.c (sfnt_get_interface): Don't use `module'. + * src/psnames/psmodule.c (psnames_get_interface): Ditto. + + * src/cff/cffdrivr.c (cff_get_interface): Check NULL `driver'. + * src/truetype/ttdriver.c (tt_get_interface): Ditto. + 2010-01-29 suzuki toshiya Fix memory leaks in previous patch. diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 217adf2f1..dad0b65d8 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -621,14 +621,15 @@ { FT_Module sfnt; FT_Module_Interface result; - FT_Library library = driver->library; - FT_UNUSED(library); result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface ); if ( result != NULL ) return result; + if ( !driver ) + return NULL; + /* we pass our request to the `sfnt' module */ sfnt = FT_Get_Module( driver->library, "sfnt" ); diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index 351885049..00b363f8b 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -561,8 +561,7 @@ psnames_get_service( FT_Module module, const char* service_id ) { - FT_Library library = module->library; - FT_UNUSED(library); + FT_UNUSED( module ); return ft_service_list_lookup( FT_PSCMAPS_SERVICES_GET, service_id ); } diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 1d157b7e9..1097efb86 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -417,8 +417,6 @@ sfnt_get_interface( FT_Module module, const char* module_interface ) { - FT_Library library = module->library; - FT_UNUSED(library); FT_UNUSED( module ); return ft_service_list_lookup( FT_SFNT_SERVICES_GET, module_interface ); diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index d4978a93c..d723b57ae 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -402,16 +402,17 @@ tt_get_interface( FT_Module driver, /* TT_Driver */ const char* tt_interface ) { - FT_Library library = driver->library; FT_Module_Interface result; FT_Module sfntd; SFNT_Service sfnt; - FT_UNUSED(library); result = ft_service_list_lookup( FT_TT_SERVICES_GET, tt_interface ); if ( result != NULL ) return result; + if ( !driver ) + return NULL; + /* only return the default interface from the SFNT module */ sfntd = FT_Get_Module( driver->library, "sfnt" ); if ( sfntd )