]> granicus.if.org Git - apache/commitdiff
core: follow up to r1836237: whitelist in-memory buckets.
authorYann Ylavic <ylavic@apache.org>
Thu, 19 Jul 2018 09:06:37 +0000 (09:06 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 19 Jul 2018 09:06:37 +0000 (09:06 +0000)
As Eric noted, this is safer w.r.t. third party buckets which could be
uncought by the previous backlist and get out of memory limits.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1836258 13f79535-47bb-0310-9956-ffa450edef68

server/core_filters.c

index a3ae9bef3f6b007c31a8ca5a838c5c275e12fc77..5e5d5cf149ca808937df5492f96f01e4532eebb0 100644 (file)
@@ -451,14 +451,11 @@ apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
 
 static APR_INLINE int is_in_memory_bucket(apr_bucket *b)
 {
-    /* The bucket data are already in memory unless:
-     *   - it's a morphing bucket (heap buffers allocated on read), or
-     *   - it's a file bucket (heap buffers also allocated on read), or
-     *   - it's a mmap bucket (mapping happens over memory access usually).
-     */
-    return b->length != (apr_size_t)-1
-           && !APR_BUCKET_IS_FILE(b)
-           && !APR_BUCKET_IS_MMAP(b);
+    /* These buckets' data are already in memory. */
+    return APR_BUCKET_IS_HEAP(b)
+           || APR_BUCKET_IS_POOL(b)
+           || APR_BUCKET_IS_TRANSIENT(b)
+           || APR_BUCKET_IS_IMMORTAL(b);
 }
 
 #if APR_HAS_SENDFILE