forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb87037b
committed
Fix contrib/seg to be more wary of long input numbers.
seg stores the number of significant digits in an input numberin a "char" field. If char is signed, and the input is more than127 digits long, the count can read out as negative causingseg_out() to print garbage (or, if you're really unlucky,even crash).To fix, clamp the digit count to be not more than FLT_DIG.(In theory this loses some information about what the originalinput was, but it doesn't seem like useful information; it wouldnot survive dump/restore in any case.)Also, in case there are stored values of the seg type containingbad data, add a clamp in seg_out's restore() subroutine.Per bug #17725 from Robins Tharakan. It's been like thisforever, so back-patch to all supported branches.Discussion:https://postgr.es/m/17725-0a09313b67fbe86e@postgresql.org1 parentae98deb commitb87037b
4 files changed
+33
-7
lines changedLines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
256 | 256 |
| |
257 | 257 |
| |
258 | 258 |
| |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
259 | 266 |
| |
260 | 267 |
| |
261 | 268 |
| |
|
Lines changed: 6 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
927 | 927 |
| |
928 | 928 |
| |
929 | 929 |
| |
930 |
| - | |
| 930 | + | |
| 931 | + | |
931 | 932 |
| |
932 |
| - | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
933 | 937 |
| |
934 | 938 |
| |
935 | 939 |
| |
|
Lines changed: 17 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| 6 | + | |
6 | 7 |
| |
7 | 8 |
| |
8 | 9 |
| |
| |||
23 | 24 |
| |
24 | 25 |
| |
25 | 26 |
| |
| 27 | + | |
| 28 | + | |
26 | 29 |
| |
27 | 30 |
| |
28 | 31 |
| |
| |||
65 | 68 |
| |
66 | 69 |
| |
67 | 70 |
| |
68 |
| - | |
| 71 | + | |
69 | 72 |
| |
70 |
| - | |
| 73 | + | |
71 | 74 |
| |
72 | 75 |
| |
73 | 76 |
| |
| |||
124 | 127 |
| |
125 | 128 |
| |
126 | 129 |
| |
127 |
| - | |
| 130 | + | |
128 | 131 |
| |
129 | 132 |
| |
130 | 133 |
| |
| |||
133 | 136 |
| |
134 | 137 |
| |
135 | 138 |
| |
136 |
| - | |
| 139 | + | |
137 | 140 |
| |
138 | 141 |
| |
139 | 142 |
| |
| |||
144 | 147 |
| |
145 | 148 |
| |
146 | 149 |
| |
147 |
| - | |
| 150 | + | |
148 | 151 |
| |
149 | 152 |
| |
150 | 153 |
| |
| |||
161 | 164 |
| |
162 | 165 |
| |
163 | 166 |
| |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
164 | 176 |
| |
165 | 177 |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
| 63 | + | |
| 64 | + | |
| 65 | + | |
63 | 66 |
| |
64 | 67 |
| |
65 | 68 |
| |
|
0 commit comments
Comments
(0)