Skip to content

Commit 3352201

Browse files
committed
[BUGFIX] Fixed ANTIDEBUG=2 not working for 32-bit applications. Fixed backward compat with older Pin versions (use INS_OperandWidth instead of INS_OperandSize)
1 parent 05a820c commit 3352201

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

AntiDebug.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,14 @@ VOID AntiDbg::WatchMemoryAccess(ADDRINT addr, UINT32 size, const ADDRINT insAddr
151151
/* ==================================================================== */
152152

153153
std::map<ADDRINT, size_t> cmpOccurrences;
154-
VOID AntiDbg::WatchCompareSoftBrk(ADDRINT Address, ADDRINT immVal)
154+
VOID AntiDbg::WatchCompareSoftBrk(ADDRINT Address, UINT64 immVal)
155155
{
156156
PinLocker locker;
157157
const WatchedType wType = isWatchedAddress(Address);
158158
if (wType == WatchedType::NOT_WATCHED) return;
159159

160160
bool isSet = false;
161161
const size_t kMinOccur = 3;
162-
163162
const UINT8 val = immVal & 0xFF;
164163
if (val == 0xCC) {
165164
cmpOccurrences[Address]++;

AntiDebug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace AntiDbg {
99
VOID WatchMemoryAccess(ADDRINT addr, UINT32 size, const ADDRINT insAddr);
1010
VOID WatchThreadStart(THREADID threadid, CONTEXT* ctxt, INT32 flags, VOID* v);
11-
VOID WatchCompareSoftBrk(ADDRINT Address, ADDRINT immVal);
11+
VOID WatchCompareSoftBrk(ADDRINT Address, UINT64 immVal);
1212
VOID MonitorAntiDbgFunctions(IMG Image);
1313
VOID FlagsCheck(const CONTEXT* ctxt, THREADID tid);
1414
VOID FlagsCheck_after(const CONTEXT* ctxt, THREADID tid, ADDRINT eip);

TinyTracer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "PinLocker.h"
2424

2525
#define TOOL_NAME "TinyTracer"
26-
#define VERSION "2.7"
26+
#define VERSION "2.7.1"
2727

2828
#include "Util.h"
2929
#include "Settings.h"
@@ -810,14 +810,14 @@ VOID InstrumentInstruction(INS ins, VOID *v)
810810
if (INS_Opcode(ins) == XED_ICLASS_CMP
811811
&& INS_OperandCount(ins) >= (opIdx + 1)
812812
&& INS_OperandIsImmediate(ins, opIdx)
813-
&& INS_OperandSize(ins, opIdx) == sizeof(UINT8))
813+
&& INS_OperandWidth(ins, opIdx) == (sizeof(UINT8)*8))
814814
{
815+
UINT64 imm = INS_OperandImmediate(ins, opIdx);
815816
INS_InsertCall(
816817
ins,
817818
IPOINT_BEFORE, (AFUNPTR)AntiDbg::WatchCompareSoftBrk,
818-
IARG_FAST_ANALYSIS_CALL,
819819
IARG_INST_PTR,
820-
IARG_ADDRINT, INS_OperandImmediate(ins, opIdx),
820+
IARG_UINT64, imm,
821821
IARG_END);
822822
}
823823
}

0 commit comments

Comments
 (0)