Fix undefined behavior sanitizer casting error in Arrangement_2_iterators.h #9143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please use the following template to help us managing pull requests.
Summary of Changes
Fixed runtime downcast errors detected by the Undefined Behavior Sanitizer (UBSan) in Arrangement_2_iterators.h.
The code was using a functional cast pointer(p), which acts like a static_cast. This caused undefined behavior when the object at p was not fully initialized as the derived type. I replaced these with reinterpret_cast(p) in both the constructors and assignment operators for I_Filtered_iterator and I_Filtered_const_iterator.
Release Management
Affected package(s): Arrangement_on_surface_2
Issue(s) solved (if any): fix #9140
Feature/Small Feature (if any):
Link to compiled documentation: N/A
License and copyright ownership: I agree to transfer the copyright of my contributions to the CGAL project owner.