Browse files

Fix a crash in JIT::getOrEmitGlobalVariable () if the code buffer ove…

…rflows.
  • Loading branch information...
1 parent 52c36f9 commit 292aa8712c3120b03f9aa1d201b2e7949adf35c3 @vargaz vargaz committed Nov 8, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/ExecutionEngine/JIT/JIT.cpp
View
3 lib/ExecutionEngine/JIT/JIT.cpp
@@ -766,6 +766,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.
}

0 comments on commit 292aa87

Please sign in to comment.