- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit44ba3f5
committed
With GB18030, prevent SIGSEGV from reading past end of allocation.
With GB18030 as source encoding, applications could crash the server viaSQL functions convert() or convert_from(). Applications themselvescould crash after passing unterminated GB18030 input to libpq functionsPQescapeLiteral(), PQescapeIdentifier(), PQescapeStringConn(), orPQescapeString(). Extension code could crash by passing unterminatedGB18030 input to jsonapi.h functions. All those functions have beenintended to handle untrusted, unterminated input safely.A crash required allocating the input such that the last byte of theallocation was the last byte of a virtual memory page. Some malloc()implementations take measures against that, making the SIGSEGV hard toreach. Back-patch to v13 (all supported versions).Author: Noah Misch <noah@leadboat.com>Author: Andres Freund <andres@anarazel.de>Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>Backpatch-through: 13Security:CVE-2025-42071 parent45fe7e0 commit44ba3f5
File tree
9 files changed
+188
-30
lines changed- src
- backend/utils/mb
- common
- include/mb
- interfaces/libpq
- test
- modules/test_escape
- regress
- expected
- sql
9 files changed
+188
-30
lines changedLines changed: 13 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1030 | 1030 |
| |
1031 | 1031 |
| |
1032 | 1032 |
| |
1033 |
| - | |
| 1033 | + | |
1034 | 1034 |
| |
1035 | 1035 |
| |
1036 | 1036 |
| |
| |||
1641 | 1641 |
| |
1642 | 1642 |
| |
1643 | 1643 |
| |
1644 |
| - | |
| 1644 | + | |
1645 | 1645 |
| |
1646 | 1646 |
| |
1647 | 1647 |
| |
1648 | 1648 |
| |
1649 |
| - | |
| 1649 | + | |
1650 | 1650 |
| |
1651 | 1651 |
| |
1652 | 1652 |
| |
| |||
1673 | 1673 |
| |
1674 | 1674 |
| |
1675 | 1675 |
| |
1676 |
| - | |
| 1676 | + | |
1677 | 1677 |
| |
1678 | 1678 |
| |
1679 | 1679 |
| |
1680 | 1680 |
| |
1681 | 1681 |
| |
1682 |
| - | |
| 1682 | + | |
1683 | 1683 |
| |
1684 | 1684 |
| |
1685 | 1685 |
| |
1686 | 1686 |
| |
1687 | 1687 |
| |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
1688 | 1696 |
| |
1689 | 1697 |
| |
1690 | 1698 |
| |
|
Lines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
692 | 692 |
| |
693 | 693 |
| |
694 | 694 |
| |
695 |
| - | |
696 |
| - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
697 | 700 |
| |
698 | 701 |
| |
699 | 702 |
| |
|
Lines changed: 45 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| 15 | + | |
| 16 | + | |
15 | 17 |
| |
16 | 18 |
| |
17 | 19 |
| |
| |||
2168 | 2170 |
| |
2169 | 2171 |
| |
2170 | 2172 |
| |
2171 |
| - | |
2172 |
| - | |
2173 |
| - | |
2174 |
| - | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
2175 | 2194 |
| |
2176 | 2195 |
| |
2177 | 2196 |
| |
| |||
2182 | 2201 |
| |
2183 | 2202 |
| |
2184 | 2203 |
| |
2185 |
| - | |
2186 |
| - | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
2187 | 2226 |
| |
2188 | 2227 |
| |
2189 | 2228 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
575 | 575 |
| |
576 | 576 |
| |
577 | 577 |
| |
| 578 | + | |
| 579 | + | |
578 | 580 |
| |
579 | 581 |
| |
580 | 582 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4003 | 4003 |
| |
4004 | 4004 |
| |
4005 | 4005 |
| |
4006 |
| - | |
| 4006 | + | |
| 4007 | + | |
4007 | 4008 |
| |
4008 | 4009 |
| |
4009 | 4010 |
| |
| |||
4149 | 4150 |
| |
4150 | 4151 |
| |
4151 | 4152 |
| |
4152 |
| - | |
| 4153 | + | |
| 4154 | + | |
4153 | 4155 |
| |
4154 | 4156 |
| |
4155 | 4157 |
| |
|
Lines changed: 6 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1173 | 1173 |
| |
1174 | 1174 |
| |
1175 | 1175 |
| |
1176 |
| - | |
1177 |
| - | |
1178 |
| - | |
1179 |
| - | |
1180 |
| - | |
1181 |
| - | |
1182 |
| - | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
1183 | 1179 |
| |
1184 | 1180 |
| |
1185 | 1181 |
| |
| |||
1188 | 1184 |
| |
1189 | 1185 |
| |
1190 | 1186 |
| |
1191 |
| - | |
1192 |
| - | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
1193 | 1190 |
| |
1194 | 1191 |
| |
1195 | 1192 |
| |
|
Lines changed: 99 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| 15 | + | |
15 | 16 |
| |
16 | 17 |
| |
17 | 18 |
| |
| |||
164 | 165 |
| |
165 | 166 |
| |
166 | 167 |
| |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
167 | 253 |
| |
168 | 254 |
| |
169 | 255 |
| |
| |||
454 | 540 |
| |
455 | 541 |
| |
456 | 542 |
| |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
457 | 547 |
| |
458 | 548 |
| |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
459 | 555 |
| |
460 | 556 |
| |
461 | 557 |
| |
| |||
864 | 960 |
| |
865 | 961 |
| |
866 | 962 |
| |
| 963 | + | |
| 964 | + | |
| 965 | + | |
867 | 966 |
| |
868 | 967 |
| |
869 | 968 |
| |
|
Lines changed: 9 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
508 | 508 |
| |
509 | 509 |
| |
510 | 510 |
| |
| 511 | + | |
511 | 512 |
| |
512 | 513 |
| |
513 |
| - | |
514 |
| - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
515 | 518 |
| |
516 | 519 |
| |
517 | 520 |
| |
| |||
520 | 523 |
| |
521 | 524 |
| |
522 | 525 |
| |
| 526 | + | |
523 | 527 |
| |
524 | 528 |
| |
525 |
| - | |
| 529 | + | |
526 | 530 |
| |
527 | 531 |
| |
528 | 532 |
| |
| |||
534 | 538 |
| |
535 | 539 |
| |
536 | 540 |
| |
| 541 | + | |
537 | 542 |
| |
538 | 543 |
| |
539 |
| - | |
| 544 | + | |
540 | 545 |
| |
541 | 546 |
| |
542 | 547 |
| |
|
Lines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
300 | 300 |
| |
301 | 301 |
| |
302 | 302 |
| |
| 303 | + | |
303 | 304 |
| |
304 | 305 |
| |
305 | 306 |
| |
306 |
| - | |
307 |
| - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
308 | 311 |
| |
309 | 312 |
| |
310 | 313 |
| |
|
0 commit comments
Comments
(0)