gcc-toolset-11-dyninst/SOURCES/dyninst-11.0.0-nullbuf.patch

26 lines
1.0 KiB
Diff
Raw Normal View History

rhbz1965455
commit 212576147 (refs/bisect/new)
Author: Xiaozhu Meng <mxz297@gmail.com>
Date: Wed May 26 11:26:28 2021 -0500
Skip parsing of blocks whose code buffer is null (#1033)
--- dyninst-11.0.0/parseAPI/src/Parser.C.orig
+++ dyninst-11.0.0/parseAPI/src/Parser.C
@@ -1703,6 +1703,14 @@ Parser::parse_frame_one_iteration(ParseFrame &frame, bool recursive) {
cur->region()->offset() + cur->region()->length() - curAddr;
const unsigned char* bufferBegin =
(const unsigned char *)(func->region()->getPtrToInstruction(curAddr));
+ if (bufferBegin == nullptr) {
+ // This can happen if jump table is over-approxiated.
+ // We ignore this block for now, and later the over-approximated block
+ // will be removed.
+ parsing_printf("\taddress %lx in a different region from the funcion entry at %lx, skip parsing\n", curAddr, func->addr());
+ continue;
+ }
+
InstructionDecoder dec(bufferBegin,size,frame.codereg->getArch());
if (!ahPtr)