BUG/MEDIUM: stick-table: fix regression caused by recent fix for out-of-memory

Commit ef8f4fe ("BUG/MINOR: stick-table: handle out-of-memory condition
gracefully") unfortunately got trapped by a pointer operation. Replacing

    ts = poll_alloc() + size;

with :

    ts = poll_alloc();
    ts += size;

Doesn't give the same result because pool_alloc() is void while ts is a
struct stksess*. So now we don't access the same places, which is visible
in certain stick-table scenarios causing a crash.

This must be backported to 1.6 and 1.5.
This commit is contained in:
Willy Tarreau 2016-11-18 18:21:39 +01:00
parent 733b1327a6
commit 5179146fa3

View File

@ -173,7 +173,7 @@ struct stksess *stksess_new(struct stktable *t, struct stktable_key *key)
ts = pool_alloc2(t->pool); ts = pool_alloc2(t->pool);
if (ts) { if (ts) {
t->current++; t->current++;
ts += t->data_size; ts = (void *)ts + t->data_size;
stksess_init(t, ts); stksess_init(t, ts);
if (key) if (key)
stksess_setkey(t, ts, key); stksess_setkey(t, ts, key);