]> granicus.if.org Git - postgresql/commitdiff
Prevent isolated second surrogate in U& syntax
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 25 Sep 2009 21:13:06 +0000 (21:13 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 25 Sep 2009 21:13:06 +0000 (21:13 +0000)
src/backend/parser/scan.l

index 70b595a6fa7b64c5583acebc4a1fe41974217154..fdc9513550980cad202a21784c71e0b88a324d4a 100644 (file)
@@ -24,7 +24,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * 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)
                                                yyerror("invalid Unicode surrogate pair");
                                        }
                                }
+                               else if (is_utf16_surrogate_second(unicode))
+                                       yyerror("invalid Unicode surrogate pair");
+
                                if (is_utf16_surrogate_first(unicode))
                                        pair_first = unicode;
                                else
@@ -1253,6 +1256,9 @@ litbuf_udeescape(unsigned char escape, base_yyscan_t yyscanner)
                                                yyerror("invalid Unicode surrogate pair");
                                        }
                                }
+                               else if (is_utf16_surrogate_second(unicode))
+                                       yyerror("invalid Unicode surrogate pair");
+
                                if (is_utf16_surrogate_first(unicode))
                                        pair_first = unicode;
                                else