906948
# ./pullrev.sh 1892413 1895552
906948
906948
https://bugzilla.redhat.com/show_bug.cgi?id=1938740
906948
906948
http://svn.apache.org/viewvc?view=revision&revision=1892413
906948
http://svn.apache.org/viewvc?view=revision&revision=1895552
906948
906948
- also mod_cgi/mod_cgid log_flags fix from r1881559
906948
906948
--- httpd-2.4.51/modules/filters/mod_deflate.c.r1892413+
906948
+++ httpd-2.4.51/modules/filters/mod_deflate.c
906948
@@ -1275,44 +1275,46 @@
906948
             if (APR_BUCKET_IS_FLUSH(bkt)) {
906948
                 apr_bucket *tmp_b;
906948
 
906948
-                ctx->inflate_total += ctx->stream.avail_out;
906948
-                zRC = inflate(&(ctx->stream), Z_SYNC_FLUSH);
906948
-                ctx->inflate_total -= ctx->stream.avail_out;
906948
-                if (zRC != Z_OK) {
906948
-                    inflateEnd(&ctx->stream);
906948
-                    ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01391)
906948
-                                  "Zlib error %d inflating data (%s)", zRC,
906948
-                                  ctx->stream.msg);
906948
-                    return APR_EGENERAL;
906948
-                }
906948
+                if (!ctx->done) {
906948
+                    ctx->inflate_total += ctx->stream.avail_out;
906948
+                    zRC = inflate(&(ctx->stream), Z_SYNC_FLUSH);
906948
+                    ctx->inflate_total -= ctx->stream.avail_out;
906948
+                    if (zRC != Z_OK) {
906948
+                        inflateEnd(&ctx->stream);
906948
+                        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01391)
906948
+                                      "Zlib error %d inflating data (%s)", zRC,
906948
+                                      ctx->stream.msg);
906948
+                        return APR_EGENERAL;
906948
+                    }
906948
  
906948
-                if (inflate_limit && ctx->inflate_total > inflate_limit) { 
906948
-                    inflateEnd(&ctx->stream);
906948
-                    ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02647)
906948
-                            "Inflated content length of %" APR_OFF_T_FMT
906948
-                            " is larger than the configured limit"
906948
-                            " of %" APR_OFF_T_FMT, 
906948
-                            ctx->inflate_total, inflate_limit);
906948
-                    return APR_ENOSPC;
906948
-                }
906948
+                    if (inflate_limit && ctx->inflate_total > inflate_limit) { 
906948
+                        inflateEnd(&ctx->stream);
906948
+                        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02647)
906948
+                                      "Inflated content length of %" APR_OFF_T_FMT
906948
+                                      " is larger than the configured limit"
906948
+                                      " of %" APR_OFF_T_FMT, 
906948
+                                      ctx->inflate_total, inflate_limit);
906948
+                        return APR_ENOSPC;
906948
+                    }
906948
 
906948
-                if (!check_ratio(r, ctx, dc)) {
906948
-                    inflateEnd(&ctx->stream);
906948
-                    ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02805)
906948
-                            "Inflated content ratio is larger than the "
906948
-                            "configured limit %i by %i time(s)",
906948
-                            dc->ratio_limit, dc->ratio_burst);
906948
-                    return APR_EINVAL;
906948
-                }
906948
+                    if (!check_ratio(r, ctx, dc)) {
906948
+                        inflateEnd(&ctx->stream);
906948
+                        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02805)
906948
+                                      "Inflated content ratio is larger than the "
906948
+                                      "configured limit %i by %i time(s)",
906948
+                                      dc->ratio_limit, dc->ratio_burst);
906948
+                        return APR_EINVAL;
906948
+                    }
906948
 
906948
-                len = c->bufferSize - ctx->stream.avail_out;
906948
-                ctx->crc = crc32(ctx->crc, (const Bytef *)ctx->buffer, len);
906948
-                tmp_b = apr_bucket_heap_create((char *)ctx->buffer, len,
906948
-                                                NULL, f->c->bucket_alloc);
906948
-                APR_BRIGADE_INSERT_TAIL(ctx->proc_bb, tmp_b);
906948
+                    len = c->bufferSize - ctx->stream.avail_out;
906948
+                    ctx->crc = crc32(ctx->crc, (const Bytef *)ctx->buffer, len);
906948
+                    tmp_b = apr_bucket_heap_create((char *)ctx->buffer, len,
906948
+                                                   NULL, f->c->bucket_alloc);
906948
+                    APR_BRIGADE_INSERT_TAIL(ctx->proc_bb, tmp_b);
906948
 
906948
-                ctx->stream.next_out = ctx->buffer;
906948
-                ctx->stream.avail_out = c->bufferSize;
906948
+                    ctx->stream.next_out = ctx->buffer;
906948
+                    ctx->stream.avail_out = c->bufferSize;
906948
+                }
906948
 
906948
                 /* Flush everything so far in the returning brigade, but continue
906948
                  * reading should EOS/more follow (don't lose them).
906948
--- httpd-2.4.51/modules/generators/mod_cgi.c.r1892413+
906948
+++ httpd-2.4.51/modules/generators/mod_cgi.c
906948
@@ -191,11 +191,10 @@
906948
     apr_file_t *f = NULL;
906948
     apr_finfo_t finfo;
906948
     char time_str[APR_CTIME_LEN];
906948
-    int log_flags = rv ? APLOG_ERR : APLOG_ERR;
906948
 
906948
     /* Intentional no APLOGNO */
906948
     /* Callee provides APLOGNO in error text */
906948
-    ap_log_rerror(APLOG_MARK, log_flags, rv, r,
906948
+    ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
906948
                   "%s%s: %s", logno ? logno : "", error, r->filename);
906948
 
906948
     /* XXX Very expensive mainline case! Open, then getfileinfo! */
906948
--- httpd-2.4.51/modules/generators/mod_cgid.c.r1892413+
906948
+++ httpd-2.4.51/modules/generators/mod_cgid.c
906948
@@ -1190,11 +1190,10 @@
906948
     apr_file_t *f = NULL;
906948
     struct stat finfo;
906948
     char time_str[APR_CTIME_LEN];
906948
-    int log_flags = rv ? APLOG_ERR : APLOG_ERR;
906948
 
906948
     /* Intentional no APLOGNO */
906948
     /* Callee provides APLOGNO in error text */
906948
-    ap_log_rerror(APLOG_MARK, log_flags, rv, r,
906948
+    ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
906948
                 "%s: %s", error, r->filename);
906948
 
906948
     /* XXX Very expensive mainline case! Open, then getfileinfo! */
906948
--- httpd-2.4.51/server/mpm_unix.c.r1892413+
906948
+++ httpd-2.4.51/server/mpm_unix.c
906948
@@ -259,10 +259,12 @@
906948
         while (cur_extra) {
906948
             ap_generation_t old_gen;
906948
             extra_process_t *next = cur_extra->next;
906948
+            pid_t pid = cur_extra->pid;
906948
 
906948
-            if (reclaim_one_pid(cur_extra->pid, action_table[cur_action].action)) {
906948
-                if (ap_unregister_extra_mpm_process(cur_extra->pid, &old_gen) == 1) {
906948
-                    mpm_callback(-1, cur_extra->pid, old_gen);
906948
+            if (reclaim_one_pid(pid, action_table[cur_action].action)) {
906948
+                if (ap_unregister_extra_mpm_process(pid, &old_gen) == 1) {
906948
+                    /* cur_extra dangling pointer from here. */
906948
+                    mpm_callback(-1, pid, old_gen);
906948
                 }
906948
                 else {
906948
                     AP_DEBUG_ASSERT(1 == 0);
906948
@@ -307,10 +309,12 @@
906948
     while (cur_extra) {
906948
         ap_generation_t old_gen;
906948
         extra_process_t *next = cur_extra->next;
906948
+        pid_t pid = cur_extra->pid;
906948
 
906948
-        if (reclaim_one_pid(cur_extra->pid, DO_NOTHING)) {
906948
-            if (ap_unregister_extra_mpm_process(cur_extra->pid, &old_gen) == 1) {
906948
-                mpm_callback(-1, cur_extra->pid, old_gen);
906948
+        if (reclaim_one_pid(pid, DO_NOTHING)) {
906948
+            if (ap_unregister_extra_mpm_process(pid, &old_gen) == 1) {
906948
+                /* cur_extra dangling pointer from here. */
906948
+                mpm_callback(-1, pid, old_gen);
906948
             }
906948
             else {
906948
                 AP_DEBUG_ASSERT(1 == 0);