From 48fd6786327ecb763005816f3b2d307de74ab227 Mon Sep 17 00:00:00 2001 From: flobernd Date: Wed, 18 Mar 2015 16:21:09 +0100 Subject: [PATCH] fixed data source position not beeing correct if the end of the input was reached while decoding an invalid instruction --- .../VXInstructionDecoder.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/VerteronDisassemblerEngine/VXInstructionDecoder.c b/VerteronDisassemblerEngine/VXInstructionDecoder.c index 51a10bd..395ac7c 100644 --- a/VerteronDisassemblerEngine/VXInstructionDecoder.c +++ b/VerteronDisassemblerEngine/VXInstructionDecoder.c @@ -1773,14 +1773,6 @@ DecodeError: info->instrAddress = instrAddress; info->instrDefinition = VXGetInstructionDefinition(0); - // Return with error, if the end of the input source was reached while decoding the - // invalid instruction - if (info->flags & IF_ERROR_END_OF_INPUT) - { - info->length = 0; - return false; - } - // Decrement the input position, if more than one byte was read from the input data // source while decoding the invalid instruction if (info->length != 1) @@ -1790,6 +1782,14 @@ DecodeError: info->length = 1; } + // Return with error, if the end of the input source was reached while decoding the + // invalid instruction + if (info->flags & IF_ERROR_END_OF_INPUT) + { + info->length = 0; + return false; + } + return true; }