Rob Shearman : widl: Fix crash in find_array_or_string_in_struct if the structure or union has no fields or cases .
Alexandre Julliard
julliard at winehq.org
Tue Jun 24 06:44:30 CDT 2008
Module: wine
Branch: master
Commit: b3dde47ed760880e323222af9ec7ad30702dec7c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b3dde47ed760880e323222af9ec7ad30702dec7c
Author: Rob Shearman <robertshearman at gmail.com>
Date: Mon Jun 23 22:28:56 2008 +0100
widl: Fix crash in find_array_or_string_in_struct if the structure or union has no fields or cases.
---
tools/widl/typegen.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 7808cea..8d86e8a 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -1721,14 +1721,20 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type
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 wine-cvs
mailing list