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

Commit8439ee4

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 parent22fce59 commit8439ee4

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
@@ -697,28 +697,32 @@ other.
697697
return IDENT;
698698
}
699699
<xui>{xuistop1}{
700-
char *ident;
700+
char *ident;
701+
intidentlen;
701702

702703
BEGIN(INITIAL);
703704
if (yyextra->literallen ==0)
704705
yyerror("zero-length delimited identifier");
705706
ident =litbuf_udeescape('\\', yyscanner);
706-
if (yyextra->literallen >= NAMEDATALEN)
707-
truncate_identifier(ident, yyextra->literallen,true);
707+
identlen =strlen(ident);
708+
if (identlen >= NAMEDATALEN)
709+
truncate_identifier(ident, identlen,true);
708710
yylval->str = ident;
709711
/* throw back all but the quote */
710712
yyless(1);
711713
return IDENT;
712714
}
713715
<xui>{xuistop2}{
714-
char *ident;
716+
char *ident;
717+
intidentlen;
715718

716719
BEGIN(INITIAL);
717720
if (yyextra->literallen ==0)
718721
yyerror("zero-length delimited identifier");
719722
ident =litbuf_udeescape(yytext[yyleng -2], yyscanner);
720-
if (yyextra->literallen >= NAMEDATALEN)
721-
truncate_identifier(ident, yyextra->literallen,true);
723+
identlen =strlen(ident);
724+
if (identlen >= NAMEDATALEN)
725+
truncate_identifier(ident, identlen,true);
722726
yylval->str = ident;
723727
return IDENT;
724728
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp