forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8442317
committed
Make the overflow guards in ExecChooseHashTableSize be more protective.
The original coding ensured nbuckets and nbatch didn't exceed INT_MAX,which while not insane on its own terms did nothing to protect subsequentcode like "palloc(nbatch * sizeof(BufFile *))". Since enormous join sizeestimates might well be planner error rather than reality, it seems bestto constrain the initial sizes to be not more than work_mem/sizeof(pointer),thus ensuring the allocated arrays don't exceed work_mem. We will allownbatch to get bigger than that during subsequent ExecHashIncreaseNumBatchescalls, but we should still guard against integer overflow in those pallocrequests. Per bug #5145 from Bernt Marius Johnsen.Although the given test case only seems to fail back to 8.2, previousreleases have variants of this issue, so patch all supported branches.1 parent9041222 commit8442317
1 file changed
+25
-18
lines changedLines changed: 25 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
394 | 394 |
| |
395 | 395 |
| |
396 | 396 |
| |
| 397 | + | |
397 | 398 |
| |
398 | 399 |
| |
399 | 400 |
| |
| |||
435 | 436 |
| |
436 | 437 |
| |
437 | 438 |
| |
438 |
| - | |
439 |
| - | |
440 |
| - | |
441 |
| - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
442 | 448 |
| |
443 |
| - | |
444 | 449 |
| |
445 |
| - | |
446 |
| - | |
447 |
| - | |
448 |
| - | |
| 450 | + | |
449 | 451 |
| |
450 | 452 |
| |
451 | 453 |
| |
| |||
455 | 457 |
| |
456 | 458 |
| |
457 | 459 |
| |
458 |
| - | |
| 460 | + | |
| 461 | + | |
459 | 462 |
| |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
460 | 467 |
| |
461 | 468 |
| |
462 | 469 |
| |
| |||
465 | 472 |
| |
466 | 473 |
| |
467 | 474 |
| |
468 |
| - | |
| 475 | + | |
469 | 476 |
| |
470 | 477 |
| |
471 | 478 |
| |
472 |
| - | |
| 479 | + | |
473 | 480 |
| |
474 | 481 |
| |
475 | 482 |
| |
| |||
481 | 488 |
| |
482 | 489 |
| |
483 | 490 |
| |
484 |
| - | |
| 491 | + | |
485 | 492 |
| |
486 | 493 |
| |
487 | 494 |
| |
| |||
555 | 562 |
| |
556 | 563 |
| |
557 | 564 |
| |
558 |
| - | |
| 565 | + | |
559 | 566 |
| |
560 | 567 |
| |
561 | 568 |
| |
| |||
1033 | 1040 |
| |
1034 | 1041 |
| |
1035 | 1042 |
| |
1036 |
| - | |
1037 |
| - | |
1038 |
| - | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
1039 | 1046 |
| |
1040 | 1047 |
| |
1041 | 1048 |
| |
|
0 commit comments
Comments
(0)