// // png_handle_pCAL from 0x86dce0 to 0x86df42 (610 bytes) // // 3 xrefs: // > png_push_read_chunk @ 0x862bc0 // > png_read_info @ 0x86593e // > png_read_end @ 0x867456 // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 12:02:56 +0000 // void __fastcall png_handle_pCAL(_DWORD *a1, int a2, unsigned int a3) { int v4; // r3 char *v7; // r8 unsigned int v8; // r4 unsigned __int8 *v9; // r4 unsigned int v10; // r7 int v12; // r10 unsigned int v13; // r12 int v14; // r2 _BOOL4 v15; // r3 _BOOL4 v16; // r3 _BOOL4 v17; // r3 int v18; // r3 unsigned __int8 *v19; // r4 char *v21; // r0 void *v22; // r11 char *v23; // lr int v24; // r0 unsigned __int8 *v25; // r3 _DWORD *v27; // r0 const char *v28; // r1 void *v29; // r1 char *v30; // r0 int v31; // [sp+18h] [bp-14h] int v32; // [sp+1Ch] [bp-10h] int v33; // [sp+1Ch] [bp-10h] int v34; // [sp+20h] [bp-Ch] int v35; // [sp+20h] [bp-Ch] int v36; // [sp+24h] [bp-8h] v4 = a1[77]; if ( (v4 & 1) == 0 ) png_chunk_error((int)a1, "missing IHDR"); if ( (v4 & 4) != 0 ) { png_crc_finish(a1, a3); png_chunk_benign_error((int)a1, "out of place"); return; } if ( a2 && (*(_DWORD *)(a2 + 8) & 0x400) != 0 ) { png_crc_finish(a1, a3); png_chunk_benign_error((int)a1, "duplicate"); return; } v7 = (char *)a1[222]; v8 = a3 + 1; if ( v7 ) { if ( v8 <= a1[223] ) goto LABEL_7; v29 = (void *)a1[222]; a1[222] = 0; a1[223] = 0; png_free((int)a1, v29); } v30 = (char *)png_malloc_base((int)a1, a3 + 1); v7 = v30; if ( !v30 ) { png_crc_finish(a1, a3); v27 = a1; v28 = "out of memory"; goto LABEL_32; } a1[222] = v30; a1[223] = v8; LABEL_7: png_crc_read(a1, (int)v7, a3); if ( png_crc_finish(a1, 0) ) return; v7[a3] = 0; v9 = (unsigned __int8 *)v7; v10 = (unsigned int)&v7[a3]; if ( *v7 ) { while ( *++v9 ) ; } if ( v10 <= (unsigned int)(v9 + 12) ) { v27 = a1; v28 = "invalid"; goto LABEL_32; } v31 = (v9[2] << 16) + (v9[1] << 24) + v9[4] + (v9[3] << 8); v12 = v9[10]; v13 = v9[9]; v14 = (v9[6] << 16) + (v9[5] << 24) + v9[8] + (v9[7] << 8); v15 = v12 != 2; if ( v9[9] ) v15 = 0; if ( v15 ) goto LABEL_33; v16 = v13 - 1 <= 1; if ( v12 == 3 ) v16 = 0; if ( v16 ) goto LABEL_33; v17 = v12 != 4; if ( v13 != 3 ) v17 = 0; if ( v17 ) { LABEL_33: v27 = a1; v28 = "invalid parameter count"; LABEL_32: png_chunk_benign_error((int)v27, v28); return; } if ( v13 > 3 ) { v35 = v9[9]; v33 = (v9[6] << 16) + (v9[5] << 24) + v9[8] + (v9[7] << 8); png_chunk_benign_error((int)a1, "unrecognized equation type"); v13 = v35; v14 = v33; } v18 = v9[11]; v36 = (int)(v9 + 11); v19 = v9 + 11; if ( v18 ) { while ( *++v19 ) ; } v34 = v13; v32 = v14; v21 = (char *)png_malloc_warn((int)a1, 4 * v12); v22 = v21; if ( !v21 ) { v27 = a1; v28 = "out of memory"; goto LABEL_32; } v23 = v21 - 4; v24 = 0; if ( v12 ) { while ( 1 ) { *((_DWORD *)v23 + 1) = v19 + 1; v23 += 4; if ( v10 < (unsigned int)(v19 + 1) ) break; if ( v19[1] ) { v25 = v19 + 2; while ( 1 ) { v19 = v25; if ( v25 == (unsigned __int8 *)(v10 + 1) ) goto LABEL_31; if ( !*v25++ ) goto LABEL_44; } } ++v19; LABEL_44: if ( v12 == ++v24 ) goto LABEL_45; } LABEL_31: png_free((int)a1, v22); v27 = a1; v28 = "invalid data"; goto LABEL_32; } LABEL_45: png_set_pCAL((int)a1, a2, v7, v31, v32, v34, v12, v36, (int)v22); png_free((int)a1, v22); }
GD Web Decomp Icon

GD Web Decomp

Raw Source