compiler: Check for EOF in malformed signatures.
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 11 Aug 2015 23:11:36 +0000 (23:11 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 11 Aug 2015 23:11:36 +0000 (23:11 +0000)
    When parsing a malformed function declaration with invalid parameters,
    gccgo would infinitely loop looking for the end of the function
    declaration.

    Fixes golang/go#11530, golang/go#11531.

    Reviewed-on: https://go-review.googlesource.com/13065

From-SVN: r226795

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/parse.cc

index 2cbe25ce606ba77573e2b1b67f2d8bbbdbdd8191..5046fbbb559b8bfb71278fae6f23fc262c54a872 100644 (file)
@@ -1,4 +1,4 @@
-3b590ff53700963c1b8207a78594138e6a4e47f4
+55175f7ee0db2c1e68423216d7744be80071ed6c
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 7f7eba489c7df1cb67b96d7b216143e3fbe727dc..211fd73b3c59c3de5fcf7c5c0633aa089dec9aff 100644 (file)
@@ -1045,7 +1045,8 @@ Parse::parameter_decl(bool parameters_have_names,
            {
              *mix_error = true;
              while (!this->peek_token()->is_op(OPERATOR_COMMA)
-                    && !this->peek_token()->is_op(OPERATOR_RPAREN))
+                    && !this->peek_token()->is_op(OPERATOR_RPAREN)
+                     && !this->peek_token()->is_eof())
                this->advance_token();
            }
        }