Prevent NULL pointer dereference passed to FT_Module_Requester.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/ChangeLog b/ChangeLog
index c2dea8f..f02fc70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-02-04 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
+ 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 <mpsuzuki@hiroshima-u.ac.jp>
Fix memory leaks in previous patch.
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 217adf2..dad0b65 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 3518850..00b363f 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 1d157b7..1097efb 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 d4978a9..d723b57 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 )