Re: [NBTREE] Possible NULL pointer dereference (backend/access/nbtree/nbutils.c)

2020-09-03 Thread Michael Paquier
On Thu, Sep 03, 2020 at 11:39:57AM -0300, Ranier Vilela wrote: > I'm using about 4 static analysis tools. It seems to me that this is the root of the problem here. -- Michael signature.asc Description: PGP signature

Re: [NBTREE] Possible NULL pointer dereference (backend/access/nbtree/nbutils.c)

2020-09-03 Thread Ranier Vilela
Em qua., 2 de set. de 2020 às 20:17, Peter Geoghegan escreveu: > On Wed, Sep 2, 2020 at 3:16 PM Ranier Vilela wrote: > Perhaps you recall our discussion of a similar false positive in > nbtsplitloc.c; that had a similar feel to it. For example, if your > static analysis tool says that code th

Re: [NBTREE] Possible NULL pointer dereference (backend/access/nbtree/nbutils.c)

2020-09-02 Thread Peter Geoghegan
On Wed, Sep 2, 2020 at 3:16 PM Ranier Vilela wrote: > Oh, I'm sorry, I thought that "hard crash" was a bad thing. I think that you are being sarcastic here, but just in case I'm wrong I'll clarify what I meant: a good sign that a static analysis tool has produced a useless complaint is that it ap

Re: [NBTREE] Possible NULL pointer dereference (backend/access/nbtree/nbutils.c)

2020-09-02 Thread Ranier Vilela
> Even if BTreeTupleGetHeapTID() did somehow return a NULL > pointer, then the user would be getting off lightly by experiencing a > hard crash instead of data corruption. > Oh, I'm sorry, I thought that "hard crash" was a bad thing. Ranier Vilela

Re: [NBTREE] Possible NULL pointer dereference (backend/access/nbtree/nbutils.c)

2020-09-02 Thread Peter Geoghegan
On Wed, Sep 2, 2020 at 2:41 PM Ranier Vilela wrote: > Maybe, better make sure, because: > 3. Line 2285 (nbtutils.c): > ItemPointerCopy(BTreeTupleGetMaxHeapTID(lastleft), pivotheaptid); > 4. Line 2316 (nbtutils.c) : > ItemPointerCopy(BTreeTupleGetHeapTID(firstright), pivotheaptid); > > Can

Re: [NBTREE] Possible NULL pointer dereference (backend/access/nbtree/nbutils.c)

2020-09-02 Thread Ranier Vilela
Also, in: 5. Line 2671 (nbtutils.c): ItemPointerGetBlockNumber(BTreeTupleGetHeapTID(newtup)), ItemPointerGetOffsetNumber(BTreeTupleGetHeapTID(newtup)), itemptr.h: /* * ItemPointerGetBlockNumberNoCheck * Returns the block number of a disk item pointer. */ #define ItemPointerGetBlockNumberNoC

[NBTREE] Possible NULL pointer dereference (backend/access/nbtree/nbutils.c)

2020-09-02 Thread Ranier Vilela
Hi, Is possible that BTreeTupleSetNAtts, leave everything tidy, so that BTreeTupleGetHeapTID doesn't fail. BTreeTupleGetHeapTID can return NULL. But, as we can see: 1. Line 2085 (nbtutils.c): if (BTreeTupleGetHeapTID(itup) != NULL && tupnatts != nkeyatts) 2. Line 803 (nbtsearch.c): if (he