Commit 7a8dfe70 by Ian Lance Taylor

compiler: Check for EOF in malformed signatures.

    
    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
parent 5d44e40b
3b590ff53700963c1b8207a78594138e6a4e47f4 55175f7ee0db2c1e68423216d7744be80071ed6c
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -1045,7 +1045,8 @@ Parse::parameter_decl(bool parameters_have_names, ...@@ -1045,7 +1045,8 @@ Parse::parameter_decl(bool parameters_have_names,
{ {
*mix_error = true; *mix_error = true;
while (!this->peek_token()->is_op(OPERATOR_COMMA) 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(); this->advance_token();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment