Skip to content

Conversation

@drslebedev
Copy link
Contributor

While running opendigitizer with ASan enabled, AddressSanitizer reported an issue in IoBuffer. This PR fixes that problem and also addresses two additional bugs in resize() and reallocate().

IoBuffer: fix allocator/resource lifetime and resize/reallocate bugs

  • Preserve the same memory_resource for allocation and deallocation to avoid alloc/dealloc mismatches (resource())
  • Fix resize() to always update _size
  • Fix reallocate() to deallocate using the old capacity
Screenshot From 2026-01-14 12-51-08

Copy link
Member

@RalphSteinhagen RalphSteinhagen left a comment

Choose a reason for hiding this comment

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

Thanks for spotting and fixing this.

* Keep the same memory_resource for alloc/free to avoid alloc-dealloc mismatch (use resource())
* Correct resize() to always update _size
* Fix reallocate() deallocation size (use old capacity)

Signed-off-by: drslebedev <dr.s.lebedev@gmail.com>
@sonarqubecloud
Copy link

@drslebedev drslebedev merged commit bf78208 into main Jan 14, 2026
10 checks passed
@drslebedev drslebedev deleted the fix_iobuffer_asan branch January 14, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants