Skip to content

Conversation

@fredroy
Copy link
Contributor

@fredroy fredroy commented Dec 31, 2025

Using the reference from top() after a pop() is Undefined Behavior (dangling reference)

Detected with AddressSanitizer

==41501==ERROR: AddressSanitizer: container-overflow on address 0x621001a70d00 at pc 0x00010d3f1730 bp 0x00016d0ee700 sp 0x00016d0ee6f8
READ of size 4 at 0x621001a70d00 thread T0
    #0 0x00010d3f172c in sofa::component::topology::container::grid::SparseGridTopology::propagateFrom(sofa::type::Vec<3u, int> const&, boost::intrusive_ptr<sofa::component::topology::container::grid::RegularGridTopology>, sofa::type::vector<sofa::component::topology::container::grid::SparseGridTopology::Type, sofa::type::CPUMemoryManager<sofa::component::topology::container::grid::SparseGridTopology::Type>>&, sofa::type::vector<bool, sofa::type::CPUMemoryManager<bool>>&, std::__1::stack<sofa::type::Vec<3u, int>, std::__1::deque<sofa::type::Vec<3u, int>, std::__1::allocator<sofa::type::Vec<3u, int>>>>&) const SparseGridTopology.cpp:1440
    #1 0x00010d3f0b70 in sofa::component::topology::container::grid::SparseGridTopology::launchPropagationFromSeed(sofa::type::Vec<3u, int> const&, boost::intrusive_ptr<sofa::component::topology::container::grid::RegularGridTopology>, sofa::type::vector<sofa::component::topology::container::grid::SparseGridTopology::Type, sofa::type::CPUMemoryManager<sofa::component::topology::container::grid::SparseGridTopology::Type>>&, sofa::type::vector<bool, sofa::type::CPUMemoryManager<bool>>&, std::__1::stack<sofa::type::Vec<3u, int>, std::__1::deque<sofa::type::Vec<3u, int>, std::__1::allocator<sofa::type::Vec<3u, int>>>>&) const SparseGridTopology.cpp:890
.......

[with-all-tests]


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@fredroy fredroy added pr: fix Fix a bug pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: status to review To notify reviewers to review this pull-request labels Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants