Skip to content

HXCPP_SANITIZE=address builds free objects that only a local holds #270

Closed

Description

@dimensionscape

ASan's use-after-return check moves a function's locals into frames off the thread stack. The collector finds live objects by scanning that stack, so in an HXCPP_SANITIZE=address build it misses what only those locals hold, and frees objects still in use.

With GCC 13 on Linux the check is on by default. GcCensus, built with ASan and run without ASAN_OPTIONS, found none of the 20,000 objects a local array kept. CI did not show it because its ASan job set detect_stack_use_after_return=0 itself.

Activity

  1. dimensionscape commented on Oct 22, 2026

    @dimensionscape
    MemberAuthor

    Fixed in 9bee2f4: the runtime supplies __asan_default_options, which turns the check off when ASan is on, and ASAN_OPTIONS still overrides it. CI's ASan job no longer sets the option, so it checks that the default holds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions