[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],null,["# Sanitizers\n\n| **Note:** This page talks about sanitizers for Android platform development. For sanitizers for app development, refer to the [NDK documentation](https://developer.android.com/ndk/guides/memory-debug).\n\nThe sanitizers are a group of dynamic analysis tools that find mistakes in\nprograms at runtime through additional instrumentation that was inserted by the\ncompiler. This includes detecting\n[memory safety](/docs/security/test/memory-safety) issues. Android supports\nand strongly recommends usage of the following sanitizers:\n\nHardware-assisted AddressSanitizer (HWASan)\n-------------------------------------------\n\n[HWASan](/docs/security/test/hwasan) is the main sanitizer to provide detection\nfor memory safety problems. It requires ARM64 and can detect:\n\n- Stack and heap buffer overflow or underflow\n- Heap use after free\n- Stack use after scope\n- Stack use after return\n- Double free or wild free\n\nAddress sanitizer (ASan)\n------------------------\n\n[ASan](/docs/security/test/asan) is a tool similar to HWASan. It works on more\nplatforms, but is unsupported on Android.\n\nKernelAddress sanitizer (KASan)\n-------------------------------\n\n[KASan](/docs/security/test/kasan) is the kernel counterpart of the userspace\ntools above. It shares the same compiler implementation. KASan and ASan/HWASan\nare complementary as one tool applies to the kernel and another to userspace.\nWe recommend enabling both at the same time to reduce the number of build\nconfigurations and to reduce the testing matrix.\n\nUndefinedBehavior sanitizer (UBSan)\n-----------------------------------\n\n[UBSan](/docs/security/test/ubsan) performs compile-time instrumentation to\ncheck for various types of (non memory-safety) undefined behavior. This includes\nsigned and unsigned integer overflow checking (IntSan), bounds checks for\nstatically-sized arrays (BoundsSan), and lots of other types of undefined\nbehavior. IntSan and BoundsSan are also suitable for enabling in production as a\nsecurity mitigation."]]