Commit 5f15595
authored
Fix integer overflow in compress plugin for large file compression (#12478)
The compress plugin was crashing when compressing large files due to integer overflow in the downstream_length tracking variable:
```
[ET_NET 4] ERROR: <InkAPI.cc:250 (TSError)> [/trafficserver/plugins/compress/compress.cc:507] [brotli_transform_finish] ERROR: brotli-transform: output lengths don't match (-2102735855, 2192231441)
Fatal: /trafficserver/src/api/InkIOCoreAPI.cc:356: failed assertion `nbytes >= 0`
traffic_server: received signal 6 (Aborted)
```
The issue occurred when compressing files larger than ~2GB, causing the 32-bit signed downstream_length to overflow and wrap to negative values, while the compression libraries' output counters (uLong/size_t) reported correct values.
Changes:
- Upgraded downstream_length from 'int' to 'int64_t' to handle large files
- Updated printf format specifiers from %d to %ld for int64_t values1 parent b13b985 commit 5f15595
2 files changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
539 | 540 | | |
540 | 541 | | |
541 | 542 | | |
542 | | - | |
| 543 | + | |
543 | 544 | | |
544 | 545 | | |
545 | 546 | | |
| |||
564 | 565 | | |
565 | 566 | | |
566 | 567 | | |
567 | | - | |
| 568 | + | |
568 | 569 | | |
569 | 570 | | |
570 | 571 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
0 commit comments