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

Commit148052d

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 parent16b06c9 commit148052d

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
@@ -696,28 +696,32 @@ other.
696696
return IDENT;
697697
}
698698
<xui>{xuistop1}{
699-
char *ident;
699+
char *ident;
700+
intidentlen;
700701

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp