- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitb7ef58a
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 parent175f7a3 commitb7ef58a
2 files changed
+41
-12
lines changedLines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
431 | 431 |
| |
432 | 432 |
| |
433 | 433 |
| |
434 |
| - | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
435 | 437 |
| |
436 | 438 |
| |
437 | 439 |
| |
|
Lines changed: 38 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
63 | 63 |
| |
64 | 64 |
| |
65 | 65 |
| |
| 66 | + | |
| 67 | + | |
66 | 68 |
| |
67 | 69 |
| |
68 | 70 |
| |
| |||
199 | 201 |
| |
200 | 202 |
| |
201 | 203 |
| |
| 204 | + | |
| 205 | + | |
202 | 206 |
| |
203 | 207 |
| |
204 | 208 |
| |
| |||
373 | 377 |
| |
374 | 378 |
| |
375 | 379 |
| |
376 |
| - | |
377 |
| - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
378 | 387 |
| |
379 | 388 |
| |
380 | 389 |
| |
| |||
515 | 524 |
| |
516 | 525 |
| |
517 | 526 |
| |
518 |
| - | |
519 | 527 |
| |
520 | 528 |
| |
521 | 529 |
| |
| |||
530 | 538 |
| |
531 | 539 |
| |
532 | 540 |
| |
533 |
| - | |
534 |
| - | |
535 |
| - | |
| 541 | + | |
536 | 542 |
| |
537 | 543 |
| |
538 | 544 |
| |
| |||
550 | 556 |
| |
551 | 557 |
| |
552 | 558 |
| |
553 |
| - | |
| 559 | + | |
554 | 560 |
| |
555 | 561 |
| |
556 | 562 |
| |
| |||
620 | 626 |
| |
621 | 627 |
| |
622 | 628 |
| |
623 |
| - | |
| 629 | + | |
624 | 630 |
| |
625 |
| - | |
| 631 | + | |
626 | 632 |
| |
627 | 633 |
| |
628 | 634 |
| |
| |||
663 | 669 |
| |
664 | 670 |
| |
665 | 671 |
| |
666 |
| - | |
| 672 | + | |
667 | 673 |
| |
668 |
| - | |
| 674 | + | |
669 | 675 |
| |
670 | 676 |
| |
671 | 677 |
| |
| |||
1397 | 1403 |
| |
1398 | 1404 |
| |
1399 | 1405 |
| |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
1400 | 1410 |
| |
1401 | 1411 |
| |
1402 | 1412 |
| |
1403 | 1413 |
| |
1404 | 1414 |
| |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
1405 | 1432 |
| |
1406 | 1433 |
| |
1407 | 1434 |
| |
|
0 commit comments
Comments
(0)