From 36cc464d2b609fc9f036140bb5d96875d14a9202 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Tue, 22 Mar 2011 14:44:56 +1100 Subject: [PATCH] Yet more 32 bit clamping. --- stream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stream.c b/stream.c index b0840eb..816fbb4 100644 --- a/stream.c +++ b/stream.c @@ -999,8 +999,11 @@ void *open_stream_out(rzip_control *control, int f, unsigned int n, i64 chunk_li limit = (control->usable_ram - (control->overhead * control->threads)) / testbufs; limit = MIN(limit, chunk_limit); } - if (BITS32) // Shouldn't be higher than this by now, but just in case + if (BITS32) { limit = MIN(limit, one_g); + if (limit + (control->overhead * control->threads) > one_g) + limit = one_g - (control->overhead * control->threads); + } /* Use a nominal minimum size should we fail all previous shrinking */ limit = MAX(limit, STREAM_BUFSIZE); retest_malloc: