Re: Bug in error reporting for multi-line JSON - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug in error reporting for multi-line JSON
Date
Msg-id 552305.1629903352@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bug in error reporting for multi-line JSON  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-bugs
Daniel Gustafsson <daniel@yesql.se> writes:
>> On 25 Aug 2021, at 10:22, tanghy.fnst@fujitsu.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



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: No libldap_r in OpenLDAP 2.5 - use LDAP_API_FEATURE_X_OPENLDAP_REENTRANT from ldap_features.h
Next
From: Rainer Tammer
Date:
Subject: Re: Postgres 9.2.13 on AIX 7.1