Module: wine
Branch: master
Commit: 50534b87d0702965339b365258f246d3f6b6501f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=50534b87d0702965339b36525…
Author: Rob Shearman <robertshearman(a)gmail.com>
Date: Tue Mar 23 13:33:21 2010 +0000
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.
---
tools/widl/parser.y | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 8a23a82..c3e1af4 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -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 (type_array_get_conformance(*ptype)->is_const)
- error_loc("%s: cannot specify size_is for a fixed sized array\n", v->name);
+ if (!type_array_get_conformance(*ptype) ||
+ type_array_get_conformance(*ptype)->type != EXPR_VOID)
+ error_loc("%s: cannot specify size_is for an already sized array\n", v->name);
else
*ptype = type_new_array((*ptype)->name,
type_array_get_element(*ptype), FALSE,