This is an automated email from the ASF dual-hosted git repository. gmurthy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push: new 20723e8 DISPATCH-1387 - fix asserts on stack operations. This closes #538 20723e8 is described below commit 20723e898aa528fad6d5f092881a5583ae5d0255 Author: Francesco Nigro <nigro....@gmail.com> AuthorDate: Thu Jul 18 16:19:46 2019 +0200 DISPATCH-1387 - fix asserts on stack operations. This closes #538 (cherry picked from commit f44f3c3276843f77197ac1e5b3014120234376ab) --- src/alloc_pool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/alloc_pool.c b/src/alloc_pool.c index c63c0dc..35c0873 100644 --- a/src/alloc_pool.c +++ b/src/alloc_pool.c @@ -104,10 +104,11 @@ static inline qd_alloc_item_t *pop_stack(qd_alloc_linked_stack_t *const stack) } prev_chunk_stack(stack); } + assert(stack->top > 0); stack->top--; - assert(stack->top >= 0 && stack->top < CHUNK_SIZE); + assert(stack->top < CHUNK_SIZE); + assert(stack->size > 0); stack->size--; - assert(stack->size >= 0); qd_alloc_item_t *item = stack->top_chunk->items[stack->top]; assert(item != NULL); return item; @@ -153,6 +154,7 @@ static inline bool push_stack(qd_alloc_linked_stack_t *stack, qd_alloc_item_t *i return false; } } + assert(stack->top < chunk_size); stack->size++; stack->top_chunk->items[stack->top] = item; stack->top++; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org