BUG #18786: Pointer bmr.rel, dereferenced by passing as 1st parameter to function is checked for NULL later - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18786: Pointer bmr.rel, dereferenced by passing as 1st parameter to function is checked for NULL later
Date
Msg-id 18786-d53753af98dc9475@postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18786
Logged by:          Daniel Elishakov
Email address:      dan-eli@mail.ru
PostgreSQL version: 16.6
Operating system:   ubuntu 20.04
Description:

I suggest the following patch to fix this issue

@@ -1872,7 +1872,7 @@ ExtendBufferedRelShared(BufferManagerRelation bmr,
         * Note that another backend might have extended the relation by the
time
         * we get the lock.
         */
-       if (!(flags & EB_SKIP_EXTENSION_LOCK))
+       if (!(flags & EB_SKIP_EXTENSION_LOCK) && bmr.rel != NULL)
        {
                LockRelationForExtension(bmr.rel, ExclusiveLock);
                if (bmr.rel)
the problem is the same as in bug-report #18785


pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #18785: Pointer bmr.rel, dereferenced by passing as 1st parameter to function is checked for NULL later
Next
From: PG Bug reporting form
Date:
Subject: BUG #18787: pointer te->defn not checked for NULL