[PATCH] bzip2recover: Add one more wraparound sanity check

Mark Wielaard mark@klomp.org
Thu Jun 11 21:10:39 GMT 2026


On Thu, May 28, 2026 at 06:49:42PM +0200, Mark Wielaard wrote:
> 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.

Pushed.

> ---
>  bzip2recover.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/bzip2recover.c b/bzip2recover.c
> index 4b1c219034c6..6f47f9173d9d 100644
> --- a/bzip2recover.c
> +++ b/bzip2recover.c
> @@ -394,6 +394,7 @@ Int32 main ( Int32 argc, Char** argv )
>              bEnd[currBlock] = 0;
>           }
>           if (currBlock > 0 &&
> +	     bEnd[currBlock] >= bStart[currBlock] &&
>  	     (bEnd[currBlock] - bStart[currBlock]) >= 130) {
>              fprintf ( stderr, "   block %d runs from " MaybeUInt64_FMT 
>                                " to " MaybeUInt64_FMT "\n",
> -- 
> 2.54.0
> 


More information about the Bzip2-devel mailing list