// // sub_C59E18 from 0xc59e18 to 0xc59fd8 (448 bytes) // // 1 xrefs: // > TIFFInitPackBits @ 0xc59fdc // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // __int64 __fastcall sub_C59E18(__int64 a1, char *a2, __int64 a3) { unsigned __int8 *v3; // x22 __int64 v5; // x19 signed __int64 v8; // x3 unsigned __int8 *v9; // x28 signed __int64 v10; // x20 size_t v11; // x20 int v12; // w1 void *v13; // x0 __int64 result; // x0 signed __int64 v15; // x19 void *v16; // x0 const void *v17; // x1 size_t v18; // x3 v3 = *(unsigned __int8 **)(a1 + 904); v5 = *(_QWORD *)(a1 + 912); LABEL_2: while ( 2 ) { if ( a3 > 0 ) { while ( 1 ) { if ( v5 <= 0 ) goto LABEL_9; v8 = *v3; v9 = v3 + 1; v10 = v5 - 1; if ( (unsigned __int64)v8 <= 0x7F ) break; if ( v8 == 128 ) { --v5; ++v3; goto LABEL_2; } v11 = 257 - v8; if ( a3 < 257 - v8 ) { v18 = v11 - a3; v11 = a3; v5 -= 2; a3 = 0; TIFFWarningExt(*(_QWORD *)(a1 + 952), "PackBitsDecode", "Discarding %lu bytes to avoid buffer overrun", v18); } else { v5 -= 2; a3 -= v11; } v12 = v3[1]; v13 = a2; v3 += 2; a2 += v11; memset(v13, v12, v11); if ( a3 <= 0 ) goto LABEL_9; } if ( a3 <= v8 ) { TIFFWarningExt( *(_QWORD *)(a1 + 952), "PackBitsDecode", "Discarding %lu bytes to avoid buffer overrun", v8 - a3 + 1); v8 = a3 - 1; if ( a3 - 1 < v10 ) goto LABEL_13; } else if ( v8 < v10 ) { LABEL_13: v15 = v8 + 1; v16 = a2; v17 = v3 + 1; a2 += v8 + 1; a3 -= v8 + 1; v3 = &v9[v8 + 1]; TIFFmemcpy(v16, v17, v8 + 1); v5 = v10 - v15; continue; } TIFFWarningExt(*(_QWORD *)(a1 + 952), "PackBitsDecode", "Terminating PackBitsDecode due to lack of data."); *(_QWORD *)(a1 + 904) = v9; *(_QWORD *)(a1 + 912) = v10; goto LABEL_18; } break; } LABEL_9: *(_QWORD *)(a1 + 904) = v3; *(_QWORD *)(a1 + 912) = v5; result = 1; if ( a3 > 0 ) { LABEL_18: TIFFErrorExt( *(_QWORD *)(a1 + 952), (__int64)"PackBitsDecode", "Not enough data for scanline %lu", *(unsigned int *)(a1 + 636)); return 0; } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source