From 4647c3d043fd06608ddd6d6c30645ca5cf380a45 Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Wed, 1 Nov 2006 13:02:25 +0000 Subject: [PATCH] * Increase the minimum and default value for MCacheMinObjectSize from 0 to 1, as a MCacheMinObjectSize of 0 does not make sense and leads to a signal Floating point exception (8) (division by zero) in memcache_gdsf_algorithm. PR: 40576 Submitted by: Xuekun Hu Reviewed by: rpluem git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@469895 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 5 +++++ docs/manual/mod/mod_mem_cache.xml | 2 +- modules/cache/mod_mem_cache.c | 9 ++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 69d52b38a5..7cd53ff650 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,11 @@ Changes with Apache 2.3.0 [Remove entries to the current 2.0 and 2.2 section below, when backported] + *) mod_mem_cache: Increase the minimum and default value for + MCacheMinObjectSize from 0 to 1, as a MCacheMinObjectSize of 0 does not + make sense and leads to a division by zero. PR 40576. + [Xuekun Hu ] + *) mod_cache: Pass the output filter stack through the store_body() hook, giving each cache backend the ability to make a better decision as to how it will allocate the tasks of writing to the diff --git a/docs/manual/mod/mod_mem_cache.xml b/docs/manual/mod/mod_mem_cache.xml index 1b2a52784a..a98fc393da 100644 --- a/docs/manual/mod/mod_mem_cache.xml +++ b/docs/manual/mod/mod_mem_cache.xml @@ -102,7 +102,7 @@ cache The minimum size (in bytes) of a document to be allowed in the cache MCacheMinObjectSize bytes -MCacheMinObjectSize 0 +MCacheMinObjectSize 1 server config diff --git a/modules/cache/mod_mem_cache.c b/modules/cache/mod_mem_cache.c index 69ffd580a5..f72a7caa7d 100644 --- a/modules/cache/mod_mem_cache.c +++ b/modules/cache/mod_mem_cache.c @@ -93,7 +93,7 @@ typedef struct { static mem_cache_conf *sconf; #define DEFAULT_MAX_CACHE_SIZE 100*1024 -#define DEFAULT_MIN_CACHE_OBJECT_SIZE 0 +#define DEFAULT_MIN_CACHE_OBJECT_SIZE 1 #define DEFAULT_MAX_CACHE_OBJECT_SIZE 10000 #define DEFAULT_MAX_OBJECT_CNT 1009 #define DEFAULT_MAX_STREAMING_BUFFER_SIZE 100000 @@ -888,9 +888,12 @@ static const char apr_size_t val; if (sscanf(arg, "%" APR_SIZE_T_FMT, &val) != 1) { - return "MCacheMinObjectSize value must be an integer (bytes)"; + return "MCacheMinObjectSize value must be an positive integer (bytes)"; } - sconf->min_cache_object_size = val; + if (val > 0) + sconf->min_cache_object_size = val; + else + return "MCacheMinObjectSize value must be an positive integer (bytes)"; return NULL; } static const char -- 2.40.0