Skip to content

memtrack: check_free_resolved_address treats an untracked address as safe (SD-06) #37

Open

Description

@hbgit

map2check_check_free_resolved_address treats an address with no memory record as a safe free, while map2check_check_free reports MEMSAFETY_FREE for the same address. Documented as SD-06 in docs/semantic-deltas.md (PR #35).

Reproduce (links against libmap2check.a, no features):

map2check_init();
map2check_check_free_resolved_address((void *)0x5000, 3, "main", 0);  /* None */
map2check_check_free("p", (void *)0x5000, 0, 4, "main");             /* MemsafetyFree */

Legacy: is_invalid_free returns TRUE for an address that is not found (lib_old/ListLog.c:95-118 on origin/refactory_memory_log), and map2check_free_resolved_address uses it (lib_old/AnalysisModeMemtrack.c:164-183).

Likely cause: is_invalid_free_resolved in rust/src/memtrack/mod.rs ends with .unwrap_or(false).

Pinned today by: rust/src/analysismode/memory.rs::free_resolved_checker_outcomes (the 0x9999 case).

Acceptance criteria:

  • Decide the contract for an untracked address (Add differential tests against the C implementation #15 can confirm the legacy verdict).
  • If it becomes an invalid free: change is_invalid_free_resolved, update the test, SD-06 in docs/semantic-deltas.md and the map2check_check_free_resolved_address section of docs/api-deltas.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions