Zebediah Figura : widl: Check for positive array dimension when parsing array.

Alexandre Julliard julliard at winehq.org
Tue Oct 9 16:22:46 CDT 2018


Module: wine
Branch: master
Commit: a2d0038045233a1830c61c4816304c33e2f92087
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a2d0038045233a1830c61c4816304c33e2f92087

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri Oct  5 16:57:47 2018 -0500

widl: Check for positive array dimension when parsing array.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/widl/parser.y | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 53a5ec0..3b99d93 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -468,8 +468,8 @@ arg:	  attributes decl_spec m_any_declarator	{ if ($2->stgclass != STG_NONE && $
 	;
 
 array:	  '[' expr ']'				{ $$ = $2;
-						  if (!$$->is_const)
-						      error_loc("array dimension is not an integer constant\n");
+						  if (!$$->is_const || $$->cval <= 0)
+						      error_loc("array dimension is not a positive integer constant\n");
 						}
 	| '[' '*' ']'				{ $$ = make_expr(EXPR_VOID); }
 	| '[' ']'				{ $$ = make_expr(EXPR_VOID); }
@@ -1554,9 +1554,6 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
   {
     if (dim->is_const)
     {
-      if (dim->cval <= 0)
-        error_loc("%s: array dimension must be positive\n", v->name);
-
       /* FIXME: should use a type_memsize that allows us to pass in a pointer size */
       if (0)
       {




More information about the wine-cvs mailing list