forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf0fc1d4
committed
Add defenses against integer overflow in dynahash numbuckets calculations.
The dynahash code requires the number of buckets in a hash table to fitin an int; but since we calculate the desired hash table size dynamically,there are various scenarios where we might calculate too large a value.The resulting overflow can lead to infinite loops, division-by-zerocrashes, etc. I (tgl) had previously installed some defenses against thatin commit299d171, but that covered only onecall path. Moreover it worked by limiting the request size to work_mem,but in a 64-bit machine it's possible to set work_mem high enough that theproblem appears anyway. So let's fix the problem at the root by installinglimits in the dynahash.c functions themselves.Trouble report and patch by Jeff Davis.1 parent97a60fa commitf0fc1d4
2 files changed
+41
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
504 | | - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
505 | 507 | | |
506 | 508 | | |
507 | 509 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
| 205 | + | |
| 206 | + | |
203 | 207 | | |
204 | 208 | | |
205 | 209 | | |
| |||
374 | 378 | | |
375 | 379 | | |
376 | 380 | | |
377 | | - | |
378 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
379 | 388 | | |
380 | 389 | | |
381 | 390 | | |
| |||
518 | 527 | | |
519 | 528 | | |
520 | 529 | | |
521 | | - | |
522 | 530 | | |
523 | 531 | | |
524 | 532 | | |
| |||
533 | 541 | | |
534 | 542 | | |
535 | 543 | | |
536 | | - | |
537 | | - | |
538 | | - | |
| 544 | + | |
539 | 545 | | |
540 | 546 | | |
541 | 547 | | |
| |||
553 | 559 | | |
554 | 560 | | |
555 | 561 | | |
556 | | - | |
| 562 | + | |
557 | 563 | | |
558 | 564 | | |
559 | 565 | | |
| |||
623 | 629 | | |
624 | 630 | | |
625 | 631 | | |
626 | | - | |
| 632 | + | |
627 | 633 | | |
628 | | - | |
| 634 | + | |
629 | 635 | | |
630 | 636 | | |
631 | 637 | | |
| |||
666 | 672 | | |
667 | 673 | | |
668 | 674 | | |
669 | | - | |
| 675 | + | |
670 | 676 | | |
671 | | - | |
| 677 | + | |
672 | 678 | | |
673 | 679 | | |
674 | 680 | | |
| |||
1403 | 1409 | | |
1404 | 1410 | | |
1405 | 1411 | | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
1406 | 1416 | | |
1407 | 1417 | | |
1408 | 1418 | | |
1409 | 1419 | | |
1410 | 1420 | | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
1411 | 1438 | | |
1412 | 1439 | | |
1413 | 1440 | | |
| |||
0 commit comments
Comments
(0)