diff options
| author | Mark Wielaard <mark@klomp.org> | 2026-05-28 18:49:42 +0200 |
|---|---|---|
| committer | Mark Wielaard <mark@klomp.org> | 2026-06-11 23:09:45 +0200 |
| commit | 6ab7670e74d3bada5bf9a7dc5af28a68064db151 (patch) | |
| tree | dec1ea2a3440381dd8645435eb2c56278420555e | |
| parent | 33866efaf4b5e8d3ccdff89ba4af9e20955f4069 (diff) | |
| download | bzip2-6ab7670e74d3bada5bf9a7dc5af28a68064db151.tar.gz bzip2-6ab7670e74d3bada5bf9a7dc5af28a68064db151.tar.bz2 bzip2-6ab7670e74d3bada5bf9a7dc5af28a68064db151.zip | |
bzip2recover: Add one more wraparound sanity check
Make sure the end of the current block is actually larger than the
start of the current block. Then check the difference is big
enough. This prevents a possible unsigned underflow.
| -rw-r--r-- | bzip2recover.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/bzip2recover.c b/bzip2recover.c index 95adeeb..4de1b6f 100644 --- a/bzip2recover.c +++ b/bzip2recover.c | |||
| @@ -394,6 +394,7 @@ Int32 main ( Int32 argc, Char** argv ) | |||
| 394 | bEnd[currBlock] = 0; | 394 | bEnd[currBlock] = 0; |
| 395 | } | 395 | } |
| 396 | if (currBlock > 0 && | 396 | if (currBlock > 0 && |
| 397 | bEnd[currBlock] >= bStart[currBlock] && | ||
| 397 | (bEnd[currBlock] - bStart[currBlock]) >= 130) { | 398 | (bEnd[currBlock] - bStart[currBlock]) >= 130) { |
| 398 | fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT | 399 | fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT |
| 399 | " to " MaybeUInt64_FMT "\n", | 400 | " to " MaybeUInt64_FMT "\n", |
