ref: d9145241fe378104ba4c12a42534549faacc92e6
parent: c9669a8a632b21cdb772456f5515692df353da58
author: suzuki toshiya <[email protected]>
date: Thu Feb 4 21:58:24 EST 2010
Prevent NULL pointer dereference passed to FT_Module_Requester.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-02-04 suzuki toshiya <[email protected]>
+
+ 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 <[email protected]>
Fix memory leaks in previous patch.
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -621,13 +621,14 @@
{
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" );
--- 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 );
}
--- 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 );
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -402,15 +402,16 @@
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" );