Commit 6615446
authored
fix: handle missing match finder in Compressor safely (#425)
Replaced unsafe .unwrap() calls on self.mf.take() with safe checks that return a new InternalError variant.
This prevents a potential Denial of Service (DoS) panic if the match finder is unexpectedly None, for example, due to a previous panic poisoning the Compressor state.
Updated the return signature of Compressor::compress_to_size to support error propagation.1 parent e41044a commit 6615446
2 files changed
Lines changed: 36 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
| |||
740 | 741 | | |
741 | 742 | | |
742 | 743 | | |
743 | | - | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
744 | 748 | | |
745 | 749 | | |
746 | 750 | | |
| |||
1030 | 1034 | | |
1031 | 1035 | | |
1032 | 1036 | | |
1033 | | - | |
| 1037 | + | |
1034 | 1038 | | |
1035 | 1039 | | |
1036 | 1040 | | |
1037 | 1041 | | |
1038 | 1042 | | |
1039 | 1043 | | |
1040 | 1044 | | |
1041 | | - | |
| 1045 | + | |
1042 | 1046 | | |
1043 | 1047 | | |
1044 | | - | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1045 | 1052 | | |
1046 | 1053 | | |
1047 | 1054 | | |
| |||
1050 | 1057 | | |
1051 | 1058 | | |
1052 | 1059 | | |
1053 | | - | |
| 1060 | + | |
1054 | 1061 | | |
1055 | 1062 | | |
1056 | 1063 | | |
| |||
2407 | 2414 | | |
2408 | 2415 | | |
2409 | 2416 | | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
0 commit comments