From: | Ranier Vilela <ranier_gyn(at)hotmail(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | [PATCH] Possible arithmetic with NULL pointer or test "stack_base_ptr != NULL" is irrelevant. |
Date: | 2019-11-24 14:23:38 |
Message-ID: | MN2PR18MB29271D9AEDCD75EF356F1CC7E34B0@MN2PR18MB2927.namprd18.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Of course, I don't know if it's the best solution, but it's the most obvious.
Or the test at line 3326 is irrelavant.
\backend\tcop\postgres.c
if (stack_depth > max_stack_depth_bytes &&
stack_base_ptr != NULL)
return true;
Otherwise, if is relevant, substraction with NULL pointer is technically,undefined behavior..
Best regards.
Ranier Vilela
--- \dll\postgresql\a\backend\tcop\postgres.c 2019-11-23 13:19:20.000000000 -0300
+++ postgres.c 2019-11-24 11:13:34.131437500 -0300
@@ -3303,7 +3303,10 @@
/*
* Compute distance from reference point to my local variables
*/
- stack_depth = (long) (stack_base_ptr - &stack_top_loc);
+ if (stack_base_ptr != NULL)
+ stack_depth = (long) (stack_base_ptr - &stack_top_loc);
+ else
+ stack_depth = (long) &stack_top_loc;
/*
* Take abs value, since stacks grow up on some machines, down on others
Attachment | Content-Type | Size |
---|---|---|
postgres.c.patch | application/octet-stream | 528 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | David Steele | 2019-11-24 14:38:09 | Re: backup manifests |
Previous Message | Martijn van Oosterhout | 2019-11-24 13:19:39 | Re: LISTEN/NOTIFY testing woes |