[ros-diffs] [fireball] 37378: Rob Shearman <robertshearman at gmail.com> Mon, 23 Jun 2008 21:28:56 +0000 (22:28 +0100) widl: Fix crash in find_array_or_string_in_struct if the structure or union has no fields or cases. http://source.winehq.org/git/wine.git/?a=commit; h=b3dde47ed760880e323222af9ec7ad30702dec7c

fireball at svn.reactos.org fireball at svn.reactos.org
Sat Nov 15 19:37:15 CET 2008


Author: fireball
Date: Sat Nov 15 12:37:15 2008
New Revision: 37378

URL: http://svn.reactos.org/svn/reactos?rev=37378&view=rev
Log:
Rob Shearman <robertshearman at gmail.com> Mon, 23 Jun 2008 21:28:56 +0000 (22:28 +0100)
widl: Fix crash in find_array_or_string_in_struct if the structure or union has no fields or cases.

http://source.winehq.org/git/wine.git/?a=commit;h=b3dde47ed760880e323222af9ec7ad30702dec7c

Modified:
    trunk/reactos/tools/widl/typegen.c

Modified: trunk/reactos/tools/widl/typegen.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/typegen.c?rev=37378&r1=37377&r2=37378&view=diff
==============================================================================
--- trunk/reactos/tools/widl/typegen.c [iso-8859-1] (original)
+++ trunk/reactos/tools/widl/typegen.c [iso-8859-1] Sat Nov 15 12:37:15 2008
@@ -1659,14 +1659,20 @@
 
 static const var_t *find_array_or_string_in_struct(const type_t *type)
 {
-    const var_t *last_field = LIST_ENTRY( list_tail(type->fields_or_args), const var_t, entry );
-    const type_t *ft = last_field->type;
+    const var_t *last_field;
+    const type_t *ft;
+
+    if (!type->fields_or_args || list_empty(type->fields_or_args))
+        return NULL;
+
+    last_field = LIST_ENTRY( list_tail(type->fields_or_args), const var_t, entry );
+    ft = last_field->type;
 
     if (ft->declarray && is_conformant_array(ft))
         return last_field;
 
     if (ft->type == RPC_FC_CSTRUCT || ft->type == RPC_FC_CPSTRUCT || ft->type == RPC_FC_CVSTRUCT)
-        return find_array_or_string_in_struct(last_field->type);
+        return find_array_or_string_in_struct(ft);
     else
         return NULL;
 }



More information about the Ros-diffs mailing list