widl: Fix crash when trying to declare a fixed size array with a size_is attribute.

In this case type_array_get_conformance will return NULL. The code
here is actually replacing an existing array with an EXPR_VOID
conformance with the specified conformance, so issue an error if
type_array_get_conformance returns NULL or the conformance has already
been defined.
This commit is contained in:
Rob Shearman 2010-03-23 13:33:21 +00:00 committed by Alexandre Julliard
parent 096b3cd090
commit 50534b87d0
1 changed files with 3 additions and 2 deletions

View File

@ -1514,8 +1514,9 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
{ {
if (is_array(*ptype)) if (is_array(*ptype))
{ {
if (type_array_get_conformance(*ptype)->is_const) if (!type_array_get_conformance(*ptype) ||
error_loc("%s: cannot specify size_is for a fixed sized array\n", v->name); type_array_get_conformance(*ptype)->type != EXPR_VOID)
error_loc("%s: cannot specify size_is for an already sized array\n", v->name);
else else
*ptype = type_new_array((*ptype)->name, *ptype = type_new_array((*ptype)->name,
type_array_get_element(*ptype), FALSE, type_array_get_element(*ptype), FALSE,