forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0a52d37
committed
Avoid passing NULL to memcmp() in lookups of zero-argument functions.
A few places assumed they could pass NULL for the argtypes array whenlooking up functions known to have zero arguments. At first glanceit seems that this should be safe enough, since memcmp() is surely notallowed to fetch any bytes if its count argument is zero. However,close reading of the C standard says that such calls have undefinedbehavior, so we'd probably best avoid it.Since the number of places doing this is quite small, and some otherplaces looking up zero-argument functions were already passing dummyarrays, let's standardize on the latter solution rather than hackingthe function lookup code to avoid calling memcmp() in these cases.I also added Asserts to catch any future violations of the new rule.Given the utter lack of any evidence that this actually causes anyproblems in the field, I don't feel a need to back-patch this change.Per report from Piotr Stefaniak, though this is not his patch.1 parentd47a113 commit0a52d37
File tree
4 files changed
+12
-3
lines changed- src/backend
- commands
- parser
- utils/adt
4 files changed
+12
-3
lines changedLines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
| 168 | + | |
168 | 169 |
| |
169 | 170 |
| |
170 | 171 |
| |
| |||
230 | 231 |
| |
231 | 232 |
| |
232 | 233 |
| |
233 |
| - | |
| 234 | + | |
234 | 235 |
| |
235 | 236 |
| |
236 | 237 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
474 | 474 |
| |
475 | 475 |
| |
476 | 476 |
| |
| 477 | + | |
477 | 478 |
| |
478 | 479 |
| |
479 | 480 |
| |
480 | 481 |
| |
481 | 482 |
| |
482 |
| - | |
| 483 | + | |
483 | 484 |
| |
484 | 485 |
| |
485 | 486 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1415 | 1415 |
| |
1416 | 1416 |
| |
1417 | 1417 |
| |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
1418 | 1421 |
| |
1419 | 1422 |
| |
1420 | 1423 |
| |
| |||
2043 | 2046 |
| |
2044 | 2047 |
| |
2045 | 2048 |
| |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
2046 | 2052 |
| |
2047 | 2053 |
| |
2048 | 2054 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
718 | 718 |
| |
719 | 719 |
| |
720 | 720 |
| |
| 721 | + | |
721 | 722 |
| |
722 | 723 |
| |
723 | 724 |
| |
| |||
893 | 894 |
| |
894 | 895 |
| |
895 | 896 |
| |
896 |
| - | |
| 897 | + | |
897 | 898 |
| |
898 | 899 |
| |
899 | 900 |
| |
|
0 commit comments
Comments
(0)