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 1mIuJv-0000m9-W0 for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Aug 2021 14:56:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mIuJu-0006pT-9R for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Aug 2021 14:56:02 +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 1mIuJu-0006pL-2q for pgsql-bugs@lists.postgresql.org; Wed, 25 Aug 2021 14:56:02 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIuJs-0004Dp-14 for pgsql-bugs@postgresql.org; Wed, 25 Aug 2021 14:56:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 17PEtqRp552306; Wed, 25 Aug 2021 10:55:53 -0400 From: Tom Lane To: Daniel Gustafsson cc: "tanghy.fnst@fujitsu.com" , Hamid Akhtar , Simon Riggs , "pgsql-bugs@postgresql.org" Subject: Re: Bug in error reporting for multi-line JSON In-reply-to: References: <914794.1611252508@sss.pgh.pa.us> <01F48B70-5CAA-4922-B900-80E49A2D8488@yesql.se> <849057.1614635401@sss.pgh.pa.us> Comments: In-reply-to Daniel Gustafsson message dated "Wed, 25 Aug 2021 10:56:31 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <552304.1629903352.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 25 Aug 2021 10:55:52 -0400 Message-ID: <552305.1629903352@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Daniel Gustafsson writes: >> On 25 Aug 2021, at 10:22, tanghy.fnst@fujitsu.com wrote: >> I think the while condition "context_start < context_end" added in comm= it ffd3944ab9 is useless. Thoughts? > Judging by the diff it=E2=80=99s likely a leftover from the previous cod= ing. I don=E2=80=99t > see a case for when it would hit, but it also doesn=E2=80=99t seem to do= any harm apart > from potentially causing static analyzers to get angry. Yeah. I think that while reviewing this patch I read the while-condition as a range check on context_start, but it isn't --- both inequalities are in the same direction. I suppose there could be some quibble about what happens if context_end - context_start is so large as to overflow an integer, but that's never gonna happen (and if it did, we'd have other issues, for instance the lack of any check-for-interrupt in this loop). Will fix. regards, tom lane