Skip to content

Conversation

jserv
Copy link
Contributor

@jserv jserv commented Sep 30, 2025

GCC with AddressSanitizer reports that pathp in map_insert() may be used uninitialized:

src/map.c:593:15: error: pathp may be used uninitialized
  593 |     for (pathp--; (uintptr_t) pathp >= (uintptr_t) path; pathp--)

While the program logic ensures pathp is always initialized through rb_insert_unique() before use, static analysis cannot prove this due to the pointer-to-pointer assignment pattern. Initialize to NULL to satisfy the compiler and improve defensive programming.


Summary by cubic

Initialize pathp to NULL in map_insert() to silence GCC -Werror=maybe-uninitialized under AddressSanitizer and prevent build failures. No functional change; rb_insert_unique() still sets pathp before use, this just makes the compiler happy.

GCC with AddressSanitizer reports that pathp in map_insert() may be
used uninitialized:

src/map.c:593:15: error: pathp may be used uninitialized
  593 |     for (pathp--; (uintptr_t) pathp >= (uintptr_t) path; pathp--)

While the program logic ensures pathp is always initialized through
rb_insert_unique() before use, static analysis cannot prove this due
to the pointer-to-pointer assignment pattern. Initialize to NULL to
satisfy the compiler and improve defensive programming.
cubic-dev-ai[bot]

This comment was marked as outdated.

@jserv jserv merged commit 1a06240 into master Oct 1, 2025
60 of 70 checks passed
@jserv jserv deleted the fix-asan branch October 1, 2025 08:01
@jserv jserv added this to the release-2025.2 milestone Oct 1, 2025
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.

1 participant