forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4338ac8
committed
Fix assorted integer-overflow hazards in varbit.c.
bitshiftright() and bitshiftleft() would recursively call each otherinfinitely if the user passed INT_MIN for the shift amount, due to integeroverflow in negating the shift amount. To fix, clamp to -VARBITMAXLEN.That doesn't change the results since any shift distance larger than theinput bit string's length produces an all-zeroes result.Also fix some places that seemed inadequately paranoid about input typmodsexceeding VARBITMAXLEN. While a typmod accepted by anybit_typmodin() willcertainly be much less than that, at least some of these spots arereachable with user-chosen integer values.Andreas Seltenreich and Tom LaneDiscussion: <87d1j2zqtz.fsf@credativ.de>1 parenta209d6d commit4338ac8
1 file changed
+15
-5
lines changedLines changed: 15 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
305 | 305 |
| |
306 | 306 |
| |
307 | 307 |
| |
308 |
| - | |
| 308 | + | |
309 | 309 |
| |
310 | 310 |
| |
311 | 311 |
| |
| |||
368 | 368 |
| |
369 | 369 |
| |
370 | 370 |
| |
371 |
| - | |
| 371 | + | |
372 | 372 |
| |
373 | 373 |
| |
374 | 374 |
| |
| |||
621 | 621 |
| |
622 | 622 |
| |
623 | 623 |
| |
624 |
| - | |
| 624 | + | |
625 | 625 |
| |
626 | 626 |
| |
627 | 627 |
| |
| |||
1387 | 1387 |
| |
1388 | 1388 |
| |
1389 | 1389 |
| |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
1390 | 1394 |
| |
1391 | 1395 |
| |
1392 | 1396 |
| |
| 1397 | + | |
1393 | 1398 |
| |
1394 | 1399 |
| |
1395 | 1400 |
| |
| |||
1447 | 1452 |
| |
1448 | 1453 |
| |
1449 | 1454 |
| |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
1450 | 1459 |
| |
1451 | 1460 |
| |
1452 | 1461 |
| |
| 1462 | + | |
1453 | 1463 |
| |
1454 | 1464 |
| |
1455 | 1465 |
| |
| |||
1507 | 1517 |
| |
1508 | 1518 |
| |
1509 | 1519 |
| |
1510 |
| - | |
| 1520 | + | |
1511 | 1521 |
| |
1512 | 1522 |
| |
1513 | 1523 |
| |
| |||
1587 | 1597 |
| |
1588 | 1598 |
| |
1589 | 1599 |
| |
1590 |
| - | |
| 1600 | + | |
1591 | 1601 |
| |
1592 | 1602 |
| |
1593 | 1603 |
| |
|
0 commit comments
Comments
(0)