Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44c2163

Browse files
committed
Fix length checking for Unicode identifiers containing escapes (U&"...").
We used the length of the input string, not the de-escaped string, asthe trigger for NAMEDATALEN truncation. AFAICS this would only resultin sometimes printing a phony truncation warning; but it's just luckthat there was no worse problem, since we were violating the API specfor truncate_identifier(). Per bug #9204 from Joshua Yanovski.This has been wrong since the Unicode-identifier support was added,so back-patch to all supported branches.
1 parent3f735ae commit44c2163

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎src/backend/parser/scan.l

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -737,22 +737,25 @@ other.
737737
<xuiend>{xustop1} |
738738
<xuiend><<EOF>>{
739739
/* no UESCAPE after the quote, throw back everything */
740-
char *ident;
740+
char *ident;
741+
intidentlen;
741742

742743
yyless(0);
743744

744745
BEGIN(INITIAL);
745746
if (yyextra->literallen ==0)
746747
yyerror("zero-length delimited identifier");
747748
ident =litbuf_udeescape('\\', yyscanner);
748-
if (yyextra->literallen >= NAMEDATALEN)
749-
truncate_identifier(ident, yyextra->literallen,true);
749+
identlen =strlen(ident);
750+
if (identlen >= NAMEDATALEN)
751+
truncate_identifier(ident, identlen,true);
750752
yylval->str = ident;
751753
return IDENT;
752754
}
753755
<xuiend>{xustop2}{
754756
/* found UESCAPE after the end quote */
755-
char *ident;
757+
char *ident;
758+
intidentlen;
756759

757760
BEGIN(INITIAL);
758761
if (yyextra->literallen ==0)
@@ -764,8 +767,9 @@ other.
764767
yyerror("invalid Unicode escape character");
765768
}
766769
ident =litbuf_udeescape(yytext[yyleng -2], yyscanner);
767-
if (yyextra->literallen >= NAMEDATALEN)
768-
truncate_identifier(ident, yyextra->literallen,true);
770+
identlen =strlen(ident);
771+
if (identlen >= NAMEDATALEN)
772+
truncate_identifier(ident, identlen,true);
769773
yylval->str = ident;
770774
return IDENT;
771775
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp