Robert Shearman : widl: Prevent NULL pointer de-refs on "void *" types.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Apr 20 08:46:00 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 555cf382691e629dfabc137a22d9b7fc6b3f1108
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=555cf382691e629dfabc137a22d9b7fc6b3f1108

Author: Robert Shearman <rob at codeweavers.com>
Date:   Thu Apr 20 11:47:00 2006 +0100

widl: Prevent NULL pointer de-refs on "void *" types.

---

 tools/widl/write_msft.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index ea48a9a..d051aa5 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -783,16 +783,17 @@ static int encode_type(
     case VT_PTR:
       {
         int next_vt;
-        while((next_vt = get_type_vt(type->ref)) == 0) {
-            if(type->ref == NULL) {
-                next_vt = VT_VOID;
+        for(next_vt = 0; type->ref; type = type->ref) {
+            next_vt = get_type_vt(type->ref);
+            if (next_vt != 0)
                 break;
-            }
-            type = type->ref;
         }
+        /* if no type found then it must be void */
+        if (next_vt == 0)
+            next_vt = VT_VOID;
 
         encode_type(typelib, next_vt, type->ref, &target_type, NULL, NULL, &child_size);
-        if(type->ref->type == RPC_FC_IP) {
+        if(type->ref && (type->ref->type == RPC_FC_IP)) {
             chat("encode_type: skipping ptr\n");
             *encoded_type = target_type;
             *width = 4;




More information about the wine-cvs mailing list