[U-Boot] [PATCH] zlib: handle overflow while calculating available stream input size

Wolfgang Denk wd at denx.de
Mon Oct 17 21:46:25 CEST 2011


Dear Anatolij Gustschin,

In message <1318696372-13816-1-git-send-email-agust at denx.de> you wrote:
> If compressed data is located in sectors at the end of the flash and
> it's offset + input stream size > 0xFFFFFFFF, the uncompressing time
> is very long, since processing of the stream is done bytewise (and
> not blockwise) due to overflow in inflate_fast() while calculation
> and checking for enough input available.
> 
> Check for this overflow condition and limit the available stream
> input size to the actually max. possible input size. This fixes
> the problem.
> 
> The issue is easily reproduceable by placing a gziped bitmap in flash,
> e.g. at FFF80000, and running 'bmp' commands like 'bmp info FFF80000'
> or 'bmp display FFF80000'. The uncompressing can take up to 3 sec.
> whereas it should normaly take a fraction of a second. If the
> 'splashimage' environment variable points to this address, the
> booting time also increases significantly.
> 
> Signed-off-by: Anatolij Gustschin <agust at denx.de>
> ---
> Note:
>   there are 6 errors and 4 warning reported by checkpatch.pl
>   for this patch. I didn't fix them intentionally and used the
>   coding style of the zlib code here. The code would look ugly
>   otherwise.
> 
>  lib/zlib/inffast.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Another dream that failed.  There's nothing sadder.
	-- Kirk, "This side of Paradise", stardate 3417.3


More information about the U-Boot mailing list