forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork0
Commit253e30c
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 parentfb6825f commit253e30c
1 file changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
| 307 | + | |
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| |||
620 | 620 | | |
621 | 621 | | |
622 | 622 | | |
623 | | - | |
| 623 | + | |
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
| |||
1353 | 1353 | | |
1354 | 1354 | | |
1355 | 1355 | | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
1356 | 1360 | | |
1357 | 1361 | | |
1358 | 1362 | | |
| 1363 | + | |
1359 | 1364 | | |
1360 | 1365 | | |
1361 | 1366 | | |
| |||
1413 | 1418 | | |
1414 | 1419 | | |
1415 | 1420 | | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
1416 | 1425 | | |
1417 | 1426 | | |
1418 | 1427 | | |
| 1428 | + | |
1419 | 1429 | | |
1420 | 1430 | | |
1421 | 1431 | | |
| |||
1473 | 1483 | | |
1474 | 1484 | | |
1475 | 1485 | | |
1476 | | - | |
| 1486 | + | |
1477 | 1487 | | |
1478 | 1488 | | |
1479 | 1489 | | |
| |||
1553 | 1563 | | |
1554 | 1564 | | |
1555 | 1565 | | |
1556 | | - | |
| 1566 | + | |
1557 | 1567 | | |
1558 | 1568 | | |
1559 | 1569 | | |
| |||
0 commit comments
Comments
(0)