[mono/llvm] 21397d0d: Fix a crash in JIT::getOrEmitGlobalVariable () if the code buffer overflows.

"Zoltan Varga ([email protected])" <[email protected]> Tue, 12 Nov 2013 22:17:09 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <000001424e63c118-9b0a29e1-4ab8-45c0-aaf6-061962dfec1b-000000@email.amazonses.com>
   Branch: refs/heads/mono2
     Home: https://github.com/mono/llvm
  Compare: https://github.com/mono/llvm/compare/02356b76b137...21397d0dfa56

   Commit: 21397d0dfa56dd1b23c0eb1914b966fb93ffba28
   Author: Zoltan Varga <[email protected]> (vargaz)
     Date: 2013-11-12 22:15:06 GMT
      URL: https://github.com/mono/llvm/commit/21397d0dfa56dd1b23c0eb1914b966fb93ffba28

Fix a crash in JIT::getOrEmitGlobalVariable () if the code buffer overflows.

Changed paths:
  M lib/ExecutionEngine/JIT/JIT.cpp

Modified: lib/ExecutionEngine/JIT/JIT.cpp
===================================================================
@@ -610,6 +610,9 @@ void *JIT::getOrEmitGlobalVariable(const GlobalVariable *GV) {
     // If the global hasn't been emitted to memory yet, allocate space and
     // emit it into memory.
     Ptr = getMemoryForGV(GV);
+    if (Ptr == 0)
+       // Buffer overflow
+       return NULL;
     addGlobalMapping(GV, Ptr);
     EmitGlobalVariable(GV);  // Initialize the variable.
   }


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches