forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd7056bc
committed
Avoid fetching one past the end of translate()'s "to" parameter.
This is usually harmless, but if you were very unlucky it couldprovoke a segfault due to the "to" string being right up againstthe end of memory. Found via valgrind testing (so we might'vefound it earlier, except that our regression tests lacked anyexercise of translate()'s deletion feature).Fix by switching the order of the test-for-end-of-string andadvance-pointer steps. While here, compute "to_ptr + tolen"just once. (Smarter compilers might figure that out forthemselves, but let's just make sure.)Report and fix by Daniil Anisimov, in bug #17816.Discussion:https://postgr.es/m/17816-70f3d2764e88a108@postgresql.org1 parent6095069 commitd7056bc
File tree
3 files changed
+14
-5
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+14
-5
lines changedLines changed: 7 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
801 | 801 |
| |
802 | 802 |
| |
803 | 803 |
| |
804 |
| - | |
| 804 | + | |
| 805 | + | |
805 | 806 |
| |
806 | 807 |
| |
807 | 808 |
| |
| |||
823 | 824 |
| |
824 | 825 |
| |
825 | 826 |
| |
| 827 | + | |
826 | 828 |
| |
827 | 829 |
| |
828 | 830 |
| |
| |||
857 | 859 |
| |
858 | 860 |
| |
859 | 861 |
| |
860 |
| - | |
| 862 | + | |
861 | 863 |
| |
862 | 864 |
| |
863 | 865 |
| |
864 | 866 |
| |
865 |
| - | |
866 |
| - | |
| 867 | + | |
867 | 868 |
| |
| 869 | + | |
868 | 870 |
| |
869 |
| - | |
| 871 | + | |
870 | 872 |
| |
871 | 873 |
| |
872 | 874 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2443 | 2443 |
| |
2444 | 2444 |
| |
2445 | 2445 |
| |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
2446 | 2452 |
| |
2447 | 2453 |
| |
2448 | 2454 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
787 | 787 |
| |
788 | 788 |
| |
789 | 789 |
| |
| 790 | + | |
790 | 791 |
| |
791 | 792 |
| |
792 | 793 |
| |
|
0 commit comments
Comments
(0)