[PATCH][BUG FIX] Pointer arithmetic with NULL

From: Ranier Vilela <ranier_gyn(at)hotmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH][BUG FIX] Pointer arithmetic with NULL
Date: 2019-11-22 17:19:11
Message-ID: MN2PR18MB29278065C7E7B4F20333BDFEE3490@MN2PR18MB2927.namprd18.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
Pointer addition with NULL, is technically undefined behavior.

Best regards.
Ranier Vilela

--- \dll\postgresql-12.0\a\backend\access\transam\xlog.c Mon Sep 30 17:06:55 2019
+++ xlog.c Fri Nov 22 13:57:17 2019
@@ -1861,7 +1861,7 @@
{
Assert(((XLogPageHeader) cachedPos)->xlp_magic == XLOG_PAGE_MAGIC);
Assert(((XLogPageHeader) cachedPos)->xlp_pageaddr == ptr - (ptr % XLOG_BLCKSZ));
- return cachedPos + ptr % XLOG_BLCKSZ;
+ return ptr % XLOG_BLCKSZ;
}

/*

Attachment Content-Type Size
xlog.c.patch application/octet-stream 391 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2019-11-22 17:29:54 [PATCH][BUG FIX] Pointer var initilialized with boolean.
Previous Message Pavel Stehule 2019-11-22 16:57:12 Re: range_agg