Skip to content

Commit 6629bc7

Browse files
committed
Reject operator names >= NAMEDATALEN characters. These will not work
anyway, and in assert-enabled builds you are likely to get an assertion failure. Backpatch as far as 7.3; 7.2 seems not to have the problem.
1 parent 070a3ad commit 6629bc7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/backend/parser/scan.l

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
2626
* IDENTIFICATION
27-
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.127 2005/06/26 19:16:05 tgl Exp $
27+
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.128 2005/08/16 00:48:12 tgl Exp $
2828
*
2929
*-------------------------------------------------------------------------
3030
*/
@@ -633,6 +633,15 @@ other .
633633
return yytext[0];
634634
}
635635

636+
/*
637+
* Complain if operator is too long. Unlike the case
638+
* for identifiers, we make this an error not a notice-
639+
* and-truncate, because the odds are we are looking at
640+
* a syntactic mistake anyway.
641+
*/
642+
if (nchars >= NAMEDATALEN)
643+
yyerror("operator too long");
644+
636645
/* Convert "!=" operator to "<>" for compatibility */
637646
if (strcmp(yytext, "!=") == 0)
638647
yylval.str = pstrdup("<>");

0 commit comments

Comments
 (0)