* server/util_filter.c (ap_filter_flush): Ensure that the brigade is
empty before returning.
* server/util_filter.c (ap_filter_flush): Tweak comment; no functional
change.
PR: 36780
Submitted by: jorton
Reviewed by: jorton, minfrin, rpluem
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@800333
13f79535-47bb-0310-9956-
ffa450edef68
-*- coding: utf-8 -*-
Changes with Apache 2.2.13
+ *) Fix potential segfaults with use of the legacy ap_rputs() etc
+ interfaces, in cases where an output filter fails. PR 36780.
+ [Joe Orton]
Changes with Apache 2.2.12
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * Fix potential segfaults with transient buckets and use of
- ap_r* interfaces. PR 36780
- Trunk version of patch:
- http://svn.apache.org/viewvc?rev=583817&view=rev
- http://svn.apache.org/viewvc?rev=583830&view=rev
- Backport version for 2.2.x of patch:
- https://issues.apache.org/bugzilla/attachment.cgi?id=24087
- +1: jorton, minfrin, rpluem
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]
void *ctx)
{
ap_filter_t *f = ctx;
+ apr_status_t rv;
- return ap_pass_brigade(f, bb);
+ rv = ap_pass_brigade(f, bb);
+
+ /* Before invocation of the flush callback, apr_brigade_write et
+ * al may place transient buckets in the brigade, which will fall
+ * out of scope after returning. Empty the brigade here, to avoid
+ * issues with leaving such buckets in the brigade if some filter
+ * fails and leaves a non-empty brigade. */
+ apr_brigade_cleanup(bb);
+
+ return rv;
}
AP_DECLARE(apr_status_t) ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb)