Re: Bug in error reporting for multi-line JSON

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, Hamid Akhtar <hamid(dot)akhtar(at)gmail(dot)com>, Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Bug in error reporting for multi-line JSON
Date: 2021-08-25 14:55:52
Message-ID: 552305.1629903352@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>> On 25 Aug 2021, at 10:22, tanghy(dot)fnst(at)fujitsu(dot)com wrote:
>> I think the while condition "context_start < context_end" added in commit ffd3944ab9 is useless. Thoughts?

> Judging by the diff it’s likely a leftover from the previous coding. I don’t
> see a case for when it would hit, but it also doesn’t 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Rainer Tammer 2021-08-25 15:06:56 Re: Postgres 9.2.13 on AIX 7.1
Previous Message Tom Lane 2021-08-25 14:36:40 Re: No libldap_r in OpenLDAP 2.5 - use LDAP_API_FEATURE_X_OPENLDAP_REENTRANT from ldap_features.h

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2021-08-25 15:00:12 Re: Mark all GUC variable as PGDLLIMPORT
Previous Message Tom Lane 2021-08-25 14:41:14 Re: Mark all GUC variable as PGDLLIMPORT