You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2020/03/27 11:52:50 UTC

[Bug 64273] New: apr-util: apr_brigade_split_line leaves empty bucket when line ends with linefeed

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


[Bug 64273] apr-util: apr_brigade_split_line leaves empty bucket when line ends with linefeed

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64273

--- Comment #2 from Barnim Dzwillo <dz...@strato.de> ---
Created attachment 37130
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37130&action=edit
Simple test program to demonstrate the issue

-- 
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


[Bug 64273] apr-util: apr_brigade_split_line leaves empty bucket when line ends with linefeed

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64273

--- Comment #4 from Joe Orton <jo...@redhat.com> ---
And r1915661 which actually added the patch

-- 
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


[Bug 64273] apr-util: apr_brigade_split_line leaves empty bucket when line ends with linefeed

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64273

--- Comment #1 from Barnim Dzwillo <dz...@strato.de> ---
Created attachment 37129
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37129&action=edit
Bugfix for the described issue in apr-trunk

-- 
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


[Bug 64273] apr-util: apr_brigade_split_line leaves empty bucket when line ends with linefeed

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64273

Joe Orton <jo...@redhat.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #3 from Joe Orton <jo...@redhat.com> ---
Thanks for the patch! Merged in r1915658 with some minor tweaks.

-- 
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