]> granicus.if.org Git - libevent/commit
buffer: fix evbuffer_remove_buffer() with empty chain in front
authorAzat Khuzhin <azat@libevent.org>
Sat, 2 Mar 2019 19:50:00 +0000 (22:50 +0300)
committerAzat Khuzhin <azat@libevent.org>
Sun, 3 Mar 2019 15:00:37 +0000 (18:00 +0300)
commitfdfabbec00b36bc6d5e69b5d8719e70d6f4e5b7b
tree8108ee0bf83d69d404c687539e9e0c200aee9539
parent91acedcc97bc5ffb77622041977920812d3fcc25
buffer: fix evbuffer_remove_buffer() with empty chain in front

In case we have empty chain (chain that do not have any data, i.e. ->off
== 0) at the beginning of the buffer, and no more full chains to move to
the dst, we will skip moving of this empty chain, and hence
last_with_datap will not be adjusted, and things will be broken after.

Fix this by not relying on ->off, just count if we have something to
move that's it.

Test case from:
  https://github.com/envoyproxy/envoy/pull/6062

Fixes: #774
buffer.c
test/regress_buffer.c