[xiph-commits] r19083 - trunk/ao/include/ao

giles at svn.xiph.org giles at svn.xiph.org
Fri Feb 7 09:43:01 PST 2014


Author: giles
Date: 2014-02-07 09:43:01 -0800 (Fri, 07 Feb 2014)
New Revision: 19083

Modified:
   trunk/ao/include/ao/ao_private.h
Log:
Fix NULL pointer dereference.

Patch by Tristan Matthews. https://review.xiph.org/184/


Modified: trunk/ao/include/ao/ao_private.h
===================================================================
--- trunk/ao/include/ao/ao_private.h	2014-02-06 00:16:47 UTC (rev 19082)
+++ trunk/ao/include/ao/ao_private.h	2014-02-07 17:43:01 UTC (rev 19083)
@@ -139,9 +139,9 @@
 void ao_read_config_files (ao_config *config);
 
 #define adebug(format, args...) {\
-    if(device->verbose==2){                                             \
+    if(!device || device->verbose==2){                                  \
       if(strcmp(format,"\n")){                                          \
-        if(device->funcs->driver_info()->short_name){                   \
+        if(device && device->funcs->driver_info()->short_name){         \
           fprintf(stderr,"ao_%s debug: " format,device->funcs->driver_info()->short_name,## args); \
         }else{                                                          \
           fprintf(stderr,"debug: " format,## args);                     \
@@ -153,9 +153,9 @@
   }
 
 #define averbose(format, args...) {\
-    if(device->verbose>0){                                              \
+    if(!device || device->verbose>0){                                   \
       if(strcmp(format,"\n")){                                          \
-        if(device->funcs->driver_info()->short_name){                   \
+        if(device && device->funcs->driver_info()->short_name){         \
           fprintf(stderr,"ao_%s info: " format,device->funcs->driver_info()->short_name,## args); \
         }else{                                                          \
           fprintf(stderr,"info: " format,## args);                      \
@@ -167,9 +167,9 @@
   }
 
 #define ainfo(format, args...) {\
-    if(device->verbose>=0){                                             \
+    if(!device || device->verbose>=0){                                  \
       if(strcmp(format,"\n")){                                          \
-        if(device->funcs->driver_info()->short_name){                   \
+        if(device && device->funcs->driver_info()->short_name){         \
           fprintf(stderr,"ao_%s info: " format,device->funcs->driver_info()->short_name,## args); \
         }else{                                                          \
           fprintf(stderr,"info: " format,## args);                      \
@@ -181,9 +181,9 @@
   }
 
 #define awarn(format, args...) {\
-    if(device->verbose>=0){                                             \
+    if(!device || device->verbose>=0){                                  \
       if(strcmp(format,"\n")){                                          \
-        if(device->funcs->driver_info()->short_name){                   \
+        if(device && device->funcs->driver_info()->short_name){         \
           fprintf(stderr,"ao_%s WARNING: " format,device->funcs->driver_info()->short_name,## args); \
         }else{                                                          \
           fprintf(stderr,"WARNING: " format,## args);                   \
@@ -195,9 +195,9 @@
   }
 
 #define aerror(format, args...) {                                       \
-    if(device->verbose>=0){                                             \
+    if(!device || device->verbose>=0){                                  \
       if(strcmp(format,"\n")){                                          \
-        if(device->funcs->driver_info()->short_name){                   \
+        if(device && device->funcs->driver_info()->short_name){         \
           fprintf(stderr,"ao_%s ERROR: " format,device->funcs->driver_info()->short_name,## args); \
         }else{                                                          \
           fprintf(stderr,"ERROR: " format,## args);                     \



More information about the commits mailing list