// // png_handle_sCAL from 0x65dee8 to 0x65e088 (416 bytes) // // 3 xrefs: // > png_push_read_chunk @ 0x652b5e // > png_read_info @ 0x6558ca // > png_read_end @ 0x6573e6 // // 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 // int __fastcall png_handle_sCAL(_DWORD *a1, int a2, unsigned int a3) { int v4; // r3 int result; // r0 char *v8; // r7 unsigned int v9; // r8 void *v10; // r1 char *v11; // r0 unsigned int v12; // r2 unsigned int v13; // r10 unsigned int v14; // [sp+8h] [bp-8h] BYREF int v15; // [sp+Ch] [bp-4h] BYREF v4 = a1[77]; if ( (v4 & 1) == 0 ) png_chunk_error((int)a1, "missing IHDR"); if ( (v4 & 4) != 0 ) { png_crc_finish(a1, a3); return png_chunk_benign_error((int)a1, "out of place"); } if ( a2 && (*(_DWORD *)(a2 + 8) & 0x4000) != 0 ) { png_crc_finish(a1, a3); return png_chunk_benign_error((int)a1, "duplicate"); } if ( a3 <= 3 ) { png_crc_finish(a1, a3); return png_chunk_benign_error((int)a1, "invalid"); } v8 = (char *)a1[222]; v9 = a3 + 1; if ( !v8 ) goto LABEL_16; if ( v9 > a1[223] ) { v10 = (void *)a1[222]; a1[222] = 0; a1[223] = 0; png_free((int)a1, v10); LABEL_16: v11 = (char *)png_malloc_base((int)a1, a3 + 1); v8 = v11; if ( !v11 ) { png_chunk_benign_error((int)a1, "out of memory"); return png_crc_finish(a1, a3); } a1[222] = v11; a1[223] = v9; } png_crc_read(a1, (int)v8, a3); v8[a3] = 0; result = png_crc_finish(a1, 0); if ( !result ) { if ( (unsigned int)(unsigned __int8)*v8 - 1 <= 1 ) { v15 = 0; v14 = 1; if ( !png_check_fp_number((int)v8, a3, &v15, &v14) ) return png_chunk_benign_error((int)a1, "bad width format"); v12 = v14; if ( a3 <= v14 ) return png_chunk_benign_error((int)a1, "bad width format"); v13 = ++v14; if ( v8[v12] ) { return png_chunk_benign_error((int)a1, "bad width format"); } else if ( (v15 & 0x188) == 0x108 ) { v15 = (unsigned __int8)v8[v12]; if ( png_check_fp_number((int)v8, a3, &v15, &v14) && v14 == a3 ) { if ( (v15 & 0x188) == 0x108 ) return png_set_sCAL_s((int)a1, a2, (unsigned __int8)*v8, v8 + 1, (int)&v8[v13]); else return png_chunk_benign_error((int)a1, "non-positive height"); } else { return png_chunk_benign_error((int)a1, "bad height format"); } } else { return png_chunk_benign_error((int)a1, "non-positive width"); } } else { return png_chunk_benign_error((int)a1, "invalid unit"); } } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source