- Notifications
You must be signed in to change notification settings - Fork5
Commit691c5eb
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 parentcd3413e commit691c5eb
2 files changed
+41
-12
lines changedLines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
500 | 500 |
| |
501 | 501 |
| |
502 | 502 |
| |
503 |
| - | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
504 | 506 |
| |
505 | 507 |
| |
506 | 508 |
| |
|
Lines changed: 38 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
| 71 | + | |
| 72 | + | |
71 | 73 |
| |
72 | 74 |
| |
73 | 75 |
| |
| |||
205 | 207 |
| |
206 | 208 |
| |
207 | 209 |
| |
| 210 | + | |
| 211 | + | |
208 | 212 |
| |
209 | 213 |
| |
210 | 214 |
| |
| |||
379 | 383 |
| |
380 | 384 |
| |
381 | 385 |
| |
382 |
| - | |
383 |
| - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
384 | 393 |
| |
385 | 394 |
| |
386 | 395 |
| |
| |||
523 | 532 |
| |
524 | 533 |
| |
525 | 534 |
| |
526 |
| - | |
527 | 535 |
| |
528 | 536 |
| |
529 | 537 |
| |
| |||
538 | 546 |
| |
539 | 547 |
| |
540 | 548 |
| |
541 |
| - | |
542 |
| - | |
543 |
| - | |
| 549 | + | |
544 | 550 |
| |
545 | 551 |
| |
546 | 552 |
| |
| |||
558 | 564 |
| |
559 | 565 |
| |
560 | 566 |
| |
561 |
| - | |
| 567 | + | |
562 | 568 |
| |
563 | 569 |
| |
564 | 570 |
| |
| |||
628 | 634 |
| |
629 | 635 |
| |
630 | 636 |
| |
631 |
| - | |
| 637 | + | |
632 | 638 |
| |
633 |
| - | |
| 639 | + | |
634 | 640 |
| |
635 | 641 |
| |
636 | 642 |
| |
| |||
671 | 677 |
| |
672 | 678 |
| |
673 | 679 |
| |
674 |
| - | |
| 680 | + | |
675 | 681 |
| |
676 |
| - | |
| 682 | + | |
677 | 683 |
| |
678 | 684 |
| |
679 | 685 |
| |
| |||
1408 | 1414 |
| |
1409 | 1415 |
| |
1410 | 1416 |
| |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
1411 | 1421 |
| |
1412 | 1422 |
| |
1413 | 1423 |
| |
1414 | 1424 |
| |
1415 | 1425 |
| |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
1416 | 1443 |
| |
1417 | 1444 |
| |
1418 | 1445 |
| |
|
0 commit comments
Comments
(0)