apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 64273] New: apr-util: apr_brigade_split_line leaves empty bucket when line ends with linefeed
Date Fri, 27 Mar 2020 11:52:50 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=64273

            Bug ID: 64273
           Summary: apr-util: apr_brigade_split_line leaves empty bucket
                    when line ends with linefeed
           Product: APR
           Version: 1.6.1
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR-util
          Assignee: bugs@apr.apache.org
          Reporter: dzwillo@strato.de
  Target Milestone: ---

Created attachment 37128
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37128&action=edit
Bugfix for the described issue in apr-util-1.6.1

Hello,

When the input for a apr_brigade_split_line() ends with a linefeed, an
empty bucket will be left in the input brigade when the last input line
was processed.

In many cases this will lead to extra work for the caller, because the
input brigade is not empty after the last line was processed.

For example the httpd code has extra checks to remove empty buckets from
a brigade in httpd/server/core_filters.c:ap_core_input_filter(), where
the call to BRIGADE_NORMALIZE(b) will trigger more often.

The attached patch fixes this issue for the current apr-util-1.6.1 library,
and the other patch fixes this for the apr-trunk library.

Also attached is a simple apr_splittest.c program to demonstrate the issue:

test "aa aa\n":
- output without patch:
     in bucket 00: start 6 length 0 IS_EMPTY!
    out bucket 00: start 0 length 6
- output with patch:
     in brigade empty
    out bucket 00: start 0 length 6

Greetings,
Barnim

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message