[PATCH][BUG FIX] Pointer arithmetic with NULL

Поиск
Список
Период
Сортировка
Искать
От
Ranier Vilela
Тема
[PATCH][BUG FIX] Pointer arithmetic with NULL
Дата
Msg-id
MN2PR18MB29278065C7E7B4F20333BDFEE3490@MN2PR18MB2927.namprd18.prod.outlook.com
Список
Дерево обсуждения
[PATCH][BUG FIX] Pointer arithmetic with NULL Ranier Vilela <ranier_gyn@hotmail.com>
Re: [PATCH][BUG FIX] Pointer arithmetic with NULL Tomas Vondra <tomas.vondra@2ndquadrant.com>
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;
 	}
 
 	/*
В списке pgsql-hackers по дате отправления
От: Pavel Stehule
Дата:
Сообщение: Re: range_agg
От: Ranier Vilela
Дата:
FAQ