Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

[stable-1.8] Ubsan fixes#1114

Merged
lukaszstolarczuk merged 2 commits intopmem:stable-1.8from
igchor:ubsan_1.8
Jul 1, 2021
Merged

[stable-1.8] Ubsan fixes#1114
lukaszstolarczuk merged 2 commits intopmem:stable-1.8from
igchor:ubsan_1.8

Conversation

@igchor
Copy link
Copy Markdown
Contributor

@igchor igchor commented Jun 30, 2021

This change is Reviewable

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: Lucas A. M. Magalhães lamm@linux.ibm.com
Copy link
Copy Markdown
Member

@lukaszstolarczuk lukaszstolarczuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @igchor)

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 30, 2021

Codecov Report

Merging #1114 (9cbb22a) into stable-1.8 (197dcda) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 9cbb22a differs from pull request most recent head 44bab51. Consider uploading reports for the commit 44bab51 to get more accurate results
Impacted file tree graph

@@              Coverage Diff               @@
##           stable-1.8    #1114      +/-   ##
==============================================
- Coverage       92.18%   92.16%   -0.02%     
==============================================
  Files              34       34              
  Lines            3658     3665       +7     
==============================================
+ Hits             3372     3378       +6     
- Misses            286      287       +1     
Flag Coverage Δ
tests_clang_debug_cpp17 59.30% <0.00%> (-0.08%) ⬇️
tests_gcc_debug 94.40% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
include/libpmemobj++/container/vector.hpp 88.11% <100.00%> (+0.14%) ⬆️
include/libpmemobj++/timed_mutex.hpp 50.00% <0.00%> (-1.17%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 197dcda...44bab51. Read the comment docs.

This fixes following tests under UBSAN:
vector_modifiers_type_requirements_0_none
vector_parameters_0_none

They failed with following error message:

"runtime error: reference binding to null pointer of type"

This fix is continuation of 41ddc88
Copy link
Copy Markdown

@karczex karczex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @igchor)

@lukaszstolarczuk lukaszstolarczuk merged commit f117250 into pmem:stable-1.8 Jul 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants