[compiler-rt] [sanitizer_common] Return nullptr from ASan on ERROR_COMMITMENT_LIMIT (PR #119753)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 12:35:16 PST 2024


================
@@ -176,12 +176,12 @@ static void *ReturnNullptrOnOOMOrDie(uptr size, const char *mem_type,
   //  (the `lpMaximumApplicationAddress` field within the `SystemInfo` struct).
   //  This does not seem to be officially documented, but is corroborated here:
   //  https://stackoverflow.com/questions/45833674/why-does-virtualalloc-fail-for-lpaddress-greater-than-0x6ffffffffff
-
-  // Note - It's possible that 'ERROR_COMMITMENT_LIMIT' needs to be handled here
-  // as well. It is currently not handled due to the lack of a reproducer that
-  // induces the error code.
+  // 3. ERROR_COMMITMENT_LIMIT:
+  //  VirtualAlloc will return this if e.g. the pagefile is too small to commit
+  //  the requested amount of memory.
   if (last_error == ERROR_NOT_ENOUGH_MEMORY ||
-      last_error == ERROR_INVALID_PARAMETER)
+      last_error == ERROR_INVALID_PARAMETER ||
+      last_error == ERROR_COMMITMENT_LIMIT)
----------------
vitalybuka wrote:

would be nice to extend a test if it's reasonably easy to reproduce

https://github.com/llvm/llvm-project/pull/119753


More information about the llvm-commits mailing list