Commit 43b9089
committed
[bzip2] Fix bzip2_decompress_target: integer overflow and missing NULL check
- size*2 can overflow unsigned int when size > UINT_MAX/2, causing
malloc to allocate less memory than expected
- Add bounds check to reject oversized inputs
- Add NULL check after malloc
- Remove unused variable nZ
- Add explicit cast for size_t to unsigned int API parameter
Coverage: +18.61% edge coverage (+67 edges) in 60s run.1 parent 6c34576 commit 43b9089
1 file changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | | - | |
| 46 | + | |
40 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
41 | 51 | | |
42 | | - | |
| 52 | + | |
43 | 53 | | |
44 | 54 | | |
45 | 55 | | |
| |||
0 commit comments