Commit d39a84a6 authored by Peter Eisentraut's avatar Peter Eisentraut

Prevent isolated second surrogate in U& syntax

parent ada0116e
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.160 2009/09/25 20:51:37 petere Exp $ * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.161 2009/09/25 21:13:06 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1223,6 +1223,9 @@ litbuf_udeescape(unsigned char escape, base_yyscan_t yyscanner) ...@@ -1223,6 +1223,9 @@ litbuf_udeescape(unsigned char escape, base_yyscan_t yyscanner)
yyerror("invalid Unicode surrogate pair"); yyerror("invalid Unicode surrogate pair");
} }
} }
else if (is_utf16_surrogate_second(unicode))
yyerror("invalid Unicode surrogate pair");
if (is_utf16_surrogate_first(unicode)) if (is_utf16_surrogate_first(unicode))
pair_first = unicode; pair_first = unicode;
else else
...@@ -1253,6 +1256,9 @@ litbuf_udeescape(unsigned char escape, base_yyscan_t yyscanner) ...@@ -1253,6 +1256,9 @@ litbuf_udeescape(unsigned char escape, base_yyscan_t yyscanner)
yyerror("invalid Unicode surrogate pair"); yyerror("invalid Unicode surrogate pair");
} }
} }
else if (is_utf16_surrogate_second(unicode))
yyerror("invalid Unicode surrogate pair");
if (is_utf16_surrogate_first(unicode)) if (is_utf16_surrogate_first(unicode))
pair_first = unicode; pair_first = unicode;
else else
......
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