Commit 41ddc88a authored by Lucas A. M. Magalhaes's avatar Lucas A. M. Magalhaes Committed by Igor Chorążewicz
Browse files

vector: Fix undefined behaviour on realloc



On tests listed bellow the reserve method is being called before any
allocation on the object therefore realloc being called without
any previous allocation. Inside realloc _data is being used with the
operator '[]', as it is nullptr at that moment it's an undefined
behaviour.

This patch simply returns a call to alloc if _data is nullptr.

This tests fails on PowerPC with Segmentation Fault because of this
issue:
segment_vector_array_expsize_assign_exceptions_oom_0_none
segment_vector_array_expsize_assign_exceptions_oom_0_memcheck
segment_vector_array_expsize_capacity_exceptions_oom_0_none
segment_vector_array_expsize_capacity_exceptions_oom_0_memcheck
segment_vector_array_expsize_modifiers_exceptions_oom_0_none
segment_vector_array_expsize_modifiers_exceptions_oom_0_memcheck
segment_vector_vector_expsize_assign_exceptions_oom_0_none
segment_vector_vector_expsize_assign_exceptions_oom_0_memcheck
segment_vector_vector_expsize_capacity_exceptions_oom_0_none
segment_vector_vector_expsize_capacity_exceptions_oom_0_memcheck
segment_vector_vector_expsize_modifiers_exceptions_oom_0_none
segment_vector_vector_expsize_modifiers_exceptions_oom_0_memcheck
segment_vector_vector_fixedsize_assign_exceptions_oom_0_none
segment_vector_vector_fixedsize_assign_exceptions_oom_0_memcheck

Signed-off-by: default avatarLucas A. M. Magalhães <lamm@linux.ibm.com>
parent 197dcdaa
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment