오류: use-after-poison
삭제자 오류 해결: 포이즌 메모리 사용
개발자는 수동으로 메모리를 포이즌하여 디버깅을 사용자 지정할 수 있습니다.
예시
// example1.cpp
// use-after-poison error
#include <stdlib.h>
extern "C" void __asan_poison_memory_region(void *, size_t);
int main(int argc, char **argv) {
char *x = new char[16];
x[10] = 0;
__asan_poison_memory_region(x, 16);
int res = x[argc * 10]; // Boom!
delete [] x;
return res;
}
이 예제를 빌드하고 테스트하려면 Visual Studio 2019 버전 16.9 이상 개발자 명령 프롬프트에서 다음 명령을 실행합니다.
cl example1.cpp /fsanitize=address /Zi
devenv /debugexe example1.exe
결과 오류
참고 항목
AddressSanitizer 개요
AddressSanitizer 알려진 문제
AddressSanitizer 빌드 및 언어 참조
AddressSanitizer 런타임 참조
AddressSanitizer 섀도 바이트
AddressSanitizer 클라우드 또는 분산 테스트
AddressSanitizer 디버거 통합
AddressSanitizer 오류 예제
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기