Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Leger2014-10-22 02:32:47 -0400
committerFrederic Leger2014-10-22 02:32:47 -0400
commitd2061be518f1117071e39c6e852bdd5e262f9c00 (patch)
tree6ba2f3485d3362dfb54cc4caf83f8526359cbc39
parenta523c0b428f08e9c61ca788af97ec38bc677e313 (diff)
downloadorg.eclipse.tcf.agent-remotes/origin/master.tar.gz
org.eclipse.tcf.agent-remotes/origin/master.tar.xz
org.eclipse.tcf.agent-remotes/origin/master.zip
Disassembler - block disassembler endless loop.remotes/origin/master
Ifever the disassembler returns a bad instruction size of zero, the block disassembly could loop forever.
-rw-r--r--agent/tcf/services/disassembly.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/agent/tcf/services/disassembly.c b/agent/tcf/services/disassembly.c
index fad84be4..0295b4d6 100644
--- a/agent/tcf/services/disassembly.c
+++ b/agent/tcf/services/disassembly.c
@@ -213,7 +213,8 @@ static int disassemble_block(Context * ctx, OutputStream * out, uint8_t * mem_bu
disassembler_ok = 1;
}
if (disassembler) dr = disassembler(mem_buf + (size_t)offs, addr, size, &param);
- if (dr == NULL) {
+ /* To avoid looping forever, better check for instrcution size */
+ if ((dr == NULL) || (dr != NULL && dr->size == 0)){
static char buf[32];
static DisassemblyResult dd;
memset(&dd, 0, sizeof(dd));

Back to the top