]> granicus.if.org Git - apache/commitdiff
Fix bug in mod_deflate, which was passing calling deflate()
authorStas Bekman <stas@apache.org>
Tue, 12 Aug 2003 17:46:29 +0000 (17:46 +0000)
committerStas Bekman <stas@apache.org>
Tue, 12 Aug 2003 17:46:29 +0000 (17:46 +0000)
     without checkinig first whether it has something to deflate. (currently
     this causes deflate to generate a fatal error according to the zlib spec).
     PR 22259.
PR:
Obtained from:
Submitted by:
Reviewed by:

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

CHANGES
modules/filters/mod_deflate.c

diff --git a/CHANGES b/CHANGES
index d23ffce1c3bfd6b9fe90eb059c79dfc047467809..563a43f3939049ac2bb7c588b3829b05dc0507bc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,11 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Fix bug in mod_deflate, which was passing calling deflate()
+     without checkinig first whether it has something to deflate. (currently 
+     this causes deflate to generate a fatal error according to the zlib spec).
+     PR 22259. [Stas Bekman]
+
   *) Avoid an infinite recursion, which occured if the name of an included
      config file or directory contained a wildcard character. PR 22194.
      [AndrĂ© Malo]
index 2744515aabbd282e7a812a9e35fb5df810294b76..3730b5685b089cf72ac859c19e56a9d9f8243e6d 100644 (file)
@@ -530,10 +530,11 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
         if (APR_BUCKET_IS_FLUSH(e)) {
             apr_bucket *bkt;
             apr_status_t rv;
-
-            zRC = deflate(&(ctx->stream), Z_SYNC_FLUSH);
-            if (zRC != Z_OK) {
-                return APR_EGENERAL;
+            if (ctx->stream.avail_in > 0) {
+                zRC = deflate(&(ctx->stream), Z_SYNC_FLUSH);
+                if (zRC != Z_OK) {
+                    return APR_EGENERAL;
+                }
             }
 
             ctx->stream.next_out = ctx->buffer;