]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: buffer: Make sure b_is_null handles buffers waiting for allocation.
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 29 Jan 2019 18:10:02 +0000 (19:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 31 Jan 2019 07:07:17 +0000 (08:07 +0100)
commit203d735cac55a46326c10ee36bad241cab38ee73
tree08eb4647d9f8b2d77e18aefedbce682dbc949664
parentbb48c9a0eec653147be0e39ff85e624f7a4d5553
BUG/MEDIUM: buffer: Make sure b_is_null handles buffers waiting for allocation.

In b_is_null(), make sure we return 1 if the buffer is waiting for its
allocation, as users assume there's memory allocated if b_is_null() returns
0.

The indirect impact of not having this was that htxbuf() would not match
b_is_null() for a buffer waiting for an allocation, and would thus return
the value 1 for the htx pointer, causing various crashes under low memory
condition.

Note that this patch makes gcc versions 6 and above report two null-deref
warnings in proto_htx.c since htx_is_empty() continues to check for a null
pointer without knowing that this is protected by the test on b_is_null().
This is addressed by the following patches.

This should be backported to 1.9.
include/common/buf.h