forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit98f27aa
committed
Fix assorted security-grade bugs in the regex engine. All of these problems
are shared with Tcl, since it's their code to begin with, and the patcheshave been copied from Tcl 8.5.0. Problems:CVE-2007-4769: Inadequate check on the range of backref numbers allowscrash due to out-of-bounds read.CVE-2007-4772: Infinite loop in regex optimizer for pattern '($|^)*'.CVE-2007-6067: Very slow optimizer cleanup for regex with a large NFArepresentation, as well as crash if we encounter an out-of-memory conditionduring NFA construction.Part of the response toCVE-2007-6067 is to put a limit on the number ofstates in the NFA representation of a regex. This seems needed even thoughthe within-the-code problems have been corrected, since otherwise the codecould try to use very large amounts of memory for a suitably-crafted regex,leading to potential DOS by driving the system into swap, activating a kernelOOM killer, etc.Although there are certainly plenty of ways to drive the system into effectiveDOS with poorly-written SQL queries, these problems seem worth treating assecurity issues because many applications might accept regex search patternsfrom untrustworthy sources.Thanks to Will Drewry of Google for reporting these problems. Patches by WillDrewry and Tom Lane.Security:CVE-2007-4769,CVE-2007-4772,CVE-2007-60671 parent8af31d5 commit98f27aa
File tree
6 files changed
+143
-21
lines changed- src
- backend/regex
- include/regex
6 files changed
+143
-21
lines changedLines changed: 15 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
31 |
| - | |
| 31 | + | |
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| |||
569 | 569 |
| |
570 | 570 |
| |
571 | 571 |
| |
572 |
| - | |
573 |
| - | |
| 572 | + | |
574 | 573 |
| |
575 |
| - | |
576 |
| - | |
577 |
| - | |
| 574 | + | |
578 | 575 |
| |
579 | 576 |
| |
580 | 577 |
| |
| |||
604 | 601 |
| |
605 | 602 |
| |
606 | 603 |
| |
| 604 | + | |
| 605 | + | |
607 | 606 |
| |
| 607 | + | |
608 | 608 |
| |
609 | 609 |
| |
610 | 610 |
| |
| |||
616 | 616 |
| |
617 | 617 |
| |
618 | 618 |
| |
619 |
| - | |
| 619 | + | |
620 | 620 |
| |
621 |
| - | |
622 |
| - | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
623 | 624 |
| |
| 625 | + | |
624 | 626 |
| |
625 | 627 |
| |
626 |
| - | |
627 |
| - | |
628 |
| - | |
| 628 | + | |
629 | 629 |
| |
630 | 630 |
| |
| 631 | + | |
| 632 | + | |
631 | 633 |
| |
| 634 | + | |
632 | 635 |
| |
633 | 636 |
| |
634 | 637 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
31 |
| - | |
| 31 | + | |
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| |||
846 | 846 |
| |
847 | 847 |
| |
848 | 848 |
| |
849 |
| - | |
| 849 | + | |
850 | 850 |
| |
851 | 851 |
| |
852 | 852 |
| |
|
Lines changed: 108 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
31 |
| - | |
| 31 | + | |
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| |||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
| 63 | + | |
63 | 64 |
| |
64 | 65 |
| |
| 66 | + | |
65 | 67 |
| |
66 | 68 |
| |
67 |
| - | |
68 | 69 |
| |
69 | 70 |
| |
70 | 71 |
| |
| |||
88 | 89 |
| |
89 | 90 |
| |
90 | 91 |
| |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
91 | 143 |
| |
92 | 144 |
| |
93 | 145 |
| |
| |||
122 | 174 |
| |
123 | 175 |
| |
124 | 176 |
| |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
125 | 182 |
| |
126 | 183 |
| |
127 | 184 |
| |
| |||
158 | 215 |
| |
159 | 216 |
| |
160 | 217 |
| |
| 218 | + | |
| 219 | + | |
161 | 220 |
| |
162 | 221 |
| |
163 | 222 |
| |
| |||
220 | 279 |
| |
221 | 280 |
| |
222 | 281 |
| |
| 282 | + | |
223 | 283 |
| |
224 | 284 |
| |
225 | 285 |
| |
| |||
633 | 693 |
| |
634 | 694 |
| |
635 | 695 |
| |
| 696 | + | |
| 697 | + | |
636 | 698 |
| |
637 | 699 |
| |
638 | 700 |
| |
| |||
793 | 855 |
| |
794 | 856 |
| |
795 | 857 |
| |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
796 | 877 |
| |
797 | 878 |
| |
798 | 879 |
| |
| |||
917 | 998 |
| |
918 | 999 |
| |
919 | 1000 |
| |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
920 | 1024 |
| |
921 | 1025 |
| |
922 | 1026 |
| |
| |||
1039 | 1143 |
| |
1040 | 1144 |
| |
1041 | 1145 |
| |
1042 |
| - | |
| 1146 | + | |
| 1147 | + | |
1043 | 1148 |
| |
1044 | 1149 |
| |
1045 | 1150 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
| 2 | + | |
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| |||
73 | 73 |
| |
74 | 74 |
| |
75 | 75 |
| |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + |
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
32 |
| - | |
| 32 | + | |
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
| |||
151 | 151 |
| |
152 | 152 |
| |
153 | 153 |
| |
| 154 | + | |
154 | 155 |
| |
155 | 156 |
| |
156 | 157 |
| |
|
Lines changed: 11 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
30 |
| - | |
| 30 | + | |
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
| |||
272 | 272 |
| |
273 | 273 |
| |
274 | 274 |
| |
| 275 | + | |
275 | 276 |
| |
276 | 277 |
| |
277 | 278 |
| |
| |||
311 | 312 |
| |
312 | 313 |
| |
313 | 314 |
| |
| 315 | + | |
| 316 | + | |
| 317 | + | |
314 | 318 |
| |
315 | 319 |
| |
316 | 320 |
| |
| |||
343 | 347 |
| |
344 | 348 |
| |
345 | 349 |
| |
346 |
| - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
347 | 356 |
| |
348 | 357 |
| |
349 | 358 |
| |
|
0 commit comments
Comments
(0)