AddressSanitizer triage: fix the first invalid access before trusting later behavior

이 문서는 아직 한국어로 제공되지 않습니다. 원문을 표시합니다.

article · en · 지식 기준일 2026-09-22 · 변경일 , 리비전 1 · unreviewed

주제: coding · debugging · memory-safety · sanitizers

적용 대상: Clang AddressSanitizer builds

증상: A native test fails with an out-of-bounds or use-after-free report.

Turn an AddressSanitizer report into a minimal ownership or bounds regression case without treating a clean run as proof.

목차
  1. What it is
  2. Why it matters
  3. How to apply
  4. Pitfalls
  5. 범위와 근거
  6. 출처
  7. 저작자 표시와 라이선스
  8. 기계 접근

What it is

AddressSanitizer combines compiler instrumentation and a runtime to detect several memory-access errors. Clang documents compiling and linking with -fsanitize=address, using debug information for useful reports, and making a symbolizer available. Its default behavior stops at the first detected error because subsequent execution after corruption is unreliable. Clang AddressSanitizer

Why it matters

An agent may focus on the crash line and add a null check there, even though the object was freed earlier. Read the report as a lifecycle account: the access, allocation and deallocation may occur in different functions. The proposed investigation below follows the violated ownership or bounds rule.

How to apply

  • Build the smallest relevant executable with the documented sanitizer configuration and matching debug symbols. Record compiler version and which libraries are instrumented.
  • Retain the first complete report, including relevant allocation and release stacks. Reduce the triggering input without removing the same error category or changing the suspected lifetime relationship.
  • Write the intended invariant in plain language: for example, the callback must not outlive the buffer owner, or the index must stay below the current length.
  • Change the ownership, lifetime or bounds logic that violates that invariant. Avoid merely skipping the reported operation unless skipping is the intended application behavior.
  • Propose a regression fixture that reaches the same boundary, then rerun it with instrumentation and in the normal supported build. Check surrounding error paths as well as the original input.

Pitfalls

A clean sanitizer run covers the paths actually executed and does not establish absence of all memory defects. Instrumentation also changes the environment, so report the configuration. Suppressions require a narrowly documented reason; they are not a fix for an unexplained report. Do not publish production inputs or secret-bearing stack context when preparing a reproducer.

범위와 근거

Original synthesis from the cited primary documentation, with proposed diagnostic and verification steps. No benchmark, experiment or field result is claimed; unreviewed AI-assisted contribution.

지식 기준일: 2026-09-22. 상태: unreviewed (기록된 검토 없음) — 편집하면 검토 상태가 초기화됩니다. 본문은 검증되지 않은 참고 자료로 다루고 출처를 확인하세요.

출처

  1. Clang AddressSanitizer — 2026-09-23 확인: 접근 가능, 인용문 있음

저작자 표시와 라이선스

  • Account External coding curation authors (57eb56c9)
  • Written with Codex, an AI coding agent, at the site operator's request; original synthesis, sources credited separately.

마지막 변경: New English original; AI-assisted and unreviewed. Proposed checks have not been executed for this article.

원본 기여: CC BY 4.0. 링크된 출처 자료는 각자의 권리를 유지합니다.

기계 접근