Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n6uVa-0000YU-TB for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Jan 2022 13:14:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n6uVY-0006H3-Iv for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Jan 2022 13:14:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n6uVY-0006Gu-96 for pgsql-hackers@lists.postgresql.org; Mon, 10 Jan 2022 13:14:44 +0000 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n6uVU-0004X6-3E for pgsql-hackers@postgresql.org; Mon, 10 Jan 2022 13:14:42 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 15556580359 for ; Mon, 10 Jan 2022 08:14:39 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 10 Jan 2022 08:14:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=byqD2M C99q9ID16xJEJxYl9qzVwHLXEwyDEECqNdhPw=; b=H907FxMg/nme15L+youp85 9Yaykk3j8HWeGBPfDi8Vrs/QstetHHXkqzH5cq+CvLDaQ/uYsfsY8sjvLCpk1nZG o+A/pd+WZMcWtNZhvetTmTZA1RXkHWEjtJPtzHZVTxO2Ozvgn2rDvwTByijtTYbV U/kA35lQxCpGp9NH3xn9PIFvoBra80CvGfl8GwhD/1uanyAgwJN1UjXSiOUF94mp nIsPkuY/w1V0G2QnrSiX9ilL1GICVPByB6uHkPmpok+X+o4TSzMXWmx1sn+IeZhv zwfpiYwQEX5iXlKipwWtOcVWNvKofKQ0qHC5bUhE6Du5qvuM+UuTOoLxykms2sQw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudehuddgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgovfgvgihtqfhnlhihqddqufhprghmsghothdqkg egvdduqdehudculdeftddtmdenucfjughrpefkffggfgfhuffvtgfgsehtjeertddtfeej necuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvg hnthhrrghuthesvghnthgvrhhprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhn peelheeuffejudevvefhffevheehkeehgfefveeiueegueeliedujeeluddtlefghfenuc ffohhmrghinhepphhgtgdrlhgsnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvghrphhrih hsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 10 Jan 2022 08:14:38 -0500 (EST) Message-ID: <82fafa79-331c-9d65-e51b-8b5d1b2383fc@enterprisedb.com> Date: Mon, 10 Jan 2022 14:14:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Content-Language: en-US From: Peter Eisentraut Subject: small bug in ecpg unicode identifier error handling To: pgsql-hackers Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I think this patch is necessary: diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index 07fee80a9c..3529b2ea86 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -753,7 +753,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ } {dquote} { BEGIN(state_before_str_start); - if (literallen == 2) /* "U&" */ + if (literallen == 0) mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier"); /* The backend will truncate the identifier here. We do not as it does not change the result. */ base_yylval.str = psprintf("U&\"%s\"", literalbuf); The old code doesn't make sense. The literallen is the length of the data in literalbuf, which clearly doesn't include the "U&" as the comment suggests. A test case is to preprocess a file like this (ecpg test.pgc): exec sql select u&" which currently does *not* give the above error, but it should.