Re: Set of patch to address several Coverity issues

From: Andres Freund <andres(at)anarazel(dot)de>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Set of patch to address several Coverity issues
Date: 2015-07-08 09:16:56
Message-ID: 20150708091656.GJ10242@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-07-08 14:11:59 +0900, Michael Paquier wrote:
> Arg... I thought I triggered a couple of weeks a problem in this code
> path when desc->arg_arraytype[i] is InvalidOid with argtypes == NULL.
> Visibly I did something wrong...
>
> Speaking of which, shouldn't this thing at least use OidIsValid?
> - if (fcinfo->flinfo->fn_oid)
> + if (OidIsValid(fcinfo->flinfo->fn_oid))
> get_func_signature(fcinfo->flinfo->fn_oid, &argtypes, &nargs);

We do the current type of tests in a bunch of places, I'd not modify
code just to change it. But since apparently the whole test is
pointless, I could see replacing it by an assert.

> >> 4) Return result of timestamp2tm is not checked 2 times in
> >> GetCurrentDateTime and GetCurrentTimeUsec, while all the other 40
> >> calls of this function do sanity checks. Returning
> >> ERRCODE_DATETIME_VALUE_OUT_OF_RANGE in case of an error would be good
> >> for consistency. See 0004. (issue reported previously here
> >> CAB7nPqRSk=J8eUdd55fL-w+k=8sDTHLVBt-cgG9jWN=VO2ogBQ(at)mail(dot)gmail(dot)com)
> >
> > But the other cases accept either arbitrary input or perform timezone
> > conversions. Not the case here, no?
>
> The callers of GetCurrentDateTime() and GetCurrentTimeUsec() do some
> work on pg_tm, see time_timetz() that does accept some input
> DecodeDateTime() for example.

So what? GetCurrentDateTime()'s returned data is still pretty much
guaranteed to be correct unless a lot of things have gone wrong
previously?

> In any case, we are going to need at least (void) in front of those calls.

We're "needing" nothing of the sort.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2015-07-08 09:38:22 more-helpful-izing a debug message
Previous Message Heikki Linnakangas 2015-07-08 08:38:26 Re: configure can't detect proper pthread flags