Fix disassembly buffer size calculation for very small extraLJust parameters

This commit is contained in:
angie 2023-08-08 12:18:23 -04:00
parent 72b439fe9a
commit 119940e7b4
2 changed files with 9 additions and 1 deletions

View File

@ -50,6 +50,9 @@ extern "C" {
#define ARRAY_COUNT(arr) (sizeof(arr) / sizeof((arr)[0]))
#define RAB_MAX(a, b) ((a) > (b) ? (a) : (b))
#define RAB_MIN(a, b) ((a) < (b) ? (a) : (b))
#define RAB_STRINGIFY2(x) #x
#define RAB_STRINGIFY(x) RAB_STRINGIFY2(x)

View File

@ -68,9 +68,14 @@ size_t RabbitizerInstruction_disassembleInstruction(const RabbitizerInstruction
size_t RabbitizerInstruction_getSizeForBufferDataDisasm(UNUSED const RabbitizerInstruction *self, int extraLJust) {
size_t totalSize = 0;
int tempLJust;
totalSize += strlen(".word");
totalSize += RabbitizerConfig_Cfg.misc.opcodeLJust + extraLJust;
tempLJust = RabbitizerConfig_Cfg.misc.opcodeLJust + extraLJust;
tempLJust = RAB_MAX(tempLJust, 0);
totalSize += tempLJust;
totalSize += 11;
return totalSize;
}