// // TIFFReadDirectory from 0xc3c190 to 0xc3d350 (4544 bytes) // // 4 xrefs: // > TIFFSetDirectory @ 0xc32fa4 // > TIFFSetSubDirectory @ 0xc330f4 // > TIFFClientOpen @ 0xc592f8 // > @ 0x6a0e0 // // 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 TIFFReadDirectory(__int64 a1) { __int64 v1; // x21 __int16 v2; // w19 _QWORD *v3; // x3 _QWORD *i; // x1 __int64 v5; // t1 unsigned int v6; // w2 unsigned int v8; // w0 void (__fastcall *v9)(__int64); // x1 const char *v10; // x19 unsigned __int16 v11; // w21 unsigned __int16 v12; // w20 char *v13; // x3 unsigned __int16 *v14; // x23 unsigned int v15; // w1 __int64 v16; // x19 unsigned int v17; // w0 int v18; // w0 char *j; // x2 char *v20; // x1 char *v21; // x23 char *v22; // x22 unsigned __int16 *v23; // x21 char *v24; // x1 unsigned __int16 *v25; // x25 unsigned __int16 *v26; // x26 unsigned int v27; // w3 __int64 v28; // x7 int v29; // w0 int v30; // w2 int v31; // w4 int v32; // w8 unsigned int v33; // w6 int *v34; // x0 int v35; // w0 int v36; // w0 unsigned __int64 v38; // x0 int v39; // w1 _QWORD *v40; // x0 __int64 v41; // x5 int v42; // w2 _DWORD *v43; // x0 unsigned int v44; // w1 unsigned __int16 v45; // w0 __int64 v46; // x0 unsigned int v47; // w0 int v48; // w3 unsigned int v49; // w1 int v50; // w2 const char *v51; // x3 int v52; // w0 int v53; // w5 int v54; // w2 int v55; // w8 unsigned int v56; // w6 int v57; // w2 __int64 v58; // x2 int v59; // w1 const char *v60; // x3 char *v61; // x22 char *v62; // x19 unsigned int v63; // w1 int v64; // w27 int v65; // w27 __int64 v66; // x1 void *v67; // x2 int v68; // w28 void *v69; // x0 char v70; // w2 __int64 v71; // x0 __int64 v72; // x2 unsigned int v73; // w27 int v74; // w28 _DWORD *v75; // x0 const char *v76; // x3 unsigned __int64 v77; // x0 _DWORD *v78; // x0 const char *v79; // x3 char *v80; // x0 char *v81; // x2 char *v82; // x1 __int64 v83; // x4 int v84; // w0 _DWORD *v85; // x2 unsigned int v86; // w1 unsigned int v87; // w0 __int64 v88; // x1 unsigned __int64 *v89; // x0 unsigned __int64 *v90; // x1 unsigned __int64 *v91; // x0 unsigned __int64 v92; // x2 unsigned __int64 v93; // t1 unsigned __int64 v94; // x3 bool v95; // cf int v96; // w0 __int64 v97; // x0 __int64 v98; // x0 unsigned int v99; // w22 unsigned __int64 *v100; // x0 unsigned __int64 v101; // x26 __int64 v102; // x27 unsigned __int64 v103; // x0 unsigned __int64 v104; // x19 unsigned __int64 v105; // x21 void *v106; // x25 void *v107; // x23 __int64 v108; // x0 __int64 *v109; // x0 __int64 v110; // x1 __int64 v111; // x0 __int64 v112; // x0 unsigned int v113; // w0 unsigned __int64 v114; // x19 unsigned __int64 v115; // x19 __int64 v116; // x0 void *p; // [xsp+60h] [xbp+60h] BYREF void *v118; // [xsp+68h] [xbp+68h] BYREF v1 = *(_QWORD *)(a1 + 32); *(_QWORD *)(a1 + 24) = v1; if ( !v1 ) return 0; v2 = *(_WORD *)(a1 + 50); v3 = *(_QWORD **)(a1 + 40); if ( v2 ) { if ( v3 ) { if ( v1 == *v3 ) return 0; for ( i = *(_QWORD **)(a1 + 40); i != &v3[(unsigned __int16)(v2 - 1)]; ++i ) { v5 = i[1]; if ( v1 == v5 ) return 0; } } v6 = (unsigned __int16)(v2 + 1); } else { v6 = 1; } v8 = *(unsigned __int16 *)(a1 + 48); *(_WORD *)(a1 + 50) = v6; if ( v8 < v6 ) { v40 = TIFFCheckRealloc((_QWORD *)a1, v3, (unsigned __int16)v6, 16, "for IFD list"); if ( !v40 ) return 0; LOWORD(v6) = *(_WORD *)(a1 + 50); v3 = v40; *(_QWORD *)(a1 + 40) = v40; *(_WORD *)(a1 + 48) = 2 * v6; } v9 = *(void (__fastcall **)(__int64))(a1 + 824); v3[(unsigned __int16)v6 - 1] = v1; v9(a1); v10 = *(const char **)(a1 + 32); ++*(_WORD *)(a1 + 640); v11 = sub_C34538((const char **)a1, v10, &p, (_QWORD *)(a1 + 32)); v12 = v11; if ( !v11 ) { TIFFErrorExt(*(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Failed to read directory at offset %lu", v10); return 0; } v13 = (char *)p; v14 = (unsigned __int16 *)p; LOWORD(v15) = *(_WORD *)p; v16 = 24 * ((unsigned __int16)(v11 - 1) + 1LL); while ( 1 ) { v14 += 12; v17 = (unsigned __int16)(v15 + 1); if ( v14 == (unsigned __int16 *)((char *)p + v16) ) break; v15 = *v14; if ( v15 < v17 ) { TIFFWarningExt( *(_QWORD *)(a1 + 952), "TIFFReadDirectoryCheckOrder", "Invalid TIFF directory; tags are not sorted in ascending order"); v13 = (char *)p; break; } } v18 = (unsigned __int16)(v11 - 2); for ( j = v13 + 24; v18 != 0xFFFF; v18 = (unsigned __int16)(v18 - 1) ) { v20 = j; v21 = &v13[24 * v18 + 48]; do { while ( *((unsigned __int16 *)j - 12) != *(unsigned __int16 *)v20 ) { v20 += 24; if ( v20 == v21 ) goto LABEL_19; } *(_WORD *)v20 = 0; v20 += 24; } while ( v20 != v21 ); LABEL_19: v13 = j; j += 24; } *(_DWORD *)(a1 + 16) &= 0xFFEFFFBF; TIFFFreeDirectory(a1); TIFFDefaultDirectory(a1); TIFFSetField((const char **)a1, 284, 1); v22 = (char *)p; v23 = (unsigned __int16 *)p; while ( *v23 != 277 ) { v23 += 12; if ( v23 == (unsigned __int16 *)((char *)p + v16) ) goto LABEL_23; } if ( !(unsigned int)sub_C3879C(a1, v23, 0) ) goto LABEL_44; v22 = (char *)p; *v23 = 0; LABEL_23: v24 = &v22[v16]; do { if ( *(_WORD *)v22 == 259 ) { v38 = *((_QWORD *)v22 + 1); if ( v38 == 1 ) { v39 = sub_C35288(a1, (__int64)v22, &v118); if ( v39 != 1 ) goto LABEL_57; v38 = *((_QWORD *)v22 + 1); } v39 = 1; if ( *(unsigned __int16 *)(a1 + 130) > v38 ) goto LABEL_52; v39 = sub_C3B530(a1, (__int64)v22, &v118); LABEL_57: if ( !v39 ) { if ( !(unsigned int)TIFFSetField((const char **)a1, 259, (unsigned __int16)v118) ) goto LABEL_44; *(_WORD *)v22 = 0; goto LABEL_27; } LABEL_52: sub_C34BEC((_QWORD *)(a1 + 952), v39, (__int64)"TIFFReadDirectory", (__int64)"Compression", 0); goto LABEL_44; } v22 += 24; } while ( v22 != v24 ); if ( !(unsigned int)TIFFSetField((const char **)a1, 259, 1) ) goto LABEL_44; LABEL_27: v25 = (unsigned __int16 *)p; v26 = (unsigned __int16 *)((char *)p + v16); while ( 2 ) { v27 = *v25; if ( *v25 ) { v28 = *(_QWORD *)(a1 + 1008); v29 = -1; v30 = *(_DWORD *)(a1 + 1016); v31 = 0; while ( 1 ) { if ( v31 == v30 ) goto LABEL_35; v32 = (v29 + v30) / 2; v33 = **(_DWORD **)(v28 + 8LL * v32); if ( v33 == v27 ) break; if ( v33 >= v27 ) { v30 = (v29 + v30) / 2; } else { v29 = (v29 + v30) / 2; v31 = v32 + 1; } } if ( v32 ) { v41 = v28 + 8LL * ((v29 + v30) / 2); v42 = **(_DWORD **)(v41 - 8); if ( v42 != v27 ) { LABEL_81: v44 = v32; if ( v32 == -1 ) { LABEL_35: TIFFWarningExt( *(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Unknown field with tag %d (0x%x) encountered", v27, *v25); v34 = (int *)TIFFCreateAnonField(a1, *v25, v25[1]); v35 = TIFFMergeFields((_QWORD *)a1, v34, 1u); v27 = *v25; if ( !v35 ) { TIFFWarningExt( *(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Registering anonymous field with tag %d (0x%x) failed", v27, *v25); *v25 = 0; goto LABEL_28; } v52 = -1; v28 = *(_QWORD *)(a1 + 1008); v53 = 0; v54 = *(_DWORD *)(a1 + 1016); while ( 1 ) { if ( v53 == v54 ) { v44 = -1; if ( *v25 ) goto LABEL_66; goto LABEL_28; } v55 = (v52 + v54) / 2; v56 = **(_DWORD **)(v28 + 8LL * v55); if ( v56 == v27 ) break; if ( v56 >= v27 ) { v54 = (v52 + v54) / 2; } else { v52 = (v52 + v54) / 2; v53 = v55 + 1; } } if ( v55 ) { v83 = v28 + 8LL * ((v52 + v54) / 2); v84 = **(_DWORD **)(v83 - 8); if ( v84 != v27 ) { LABEL_189: v44 = v55; if ( *v25 ) goto LABEL_66; goto LABEL_28; } while ( --v55 ) { v85 = *(_DWORD **)(v83 - 16); v83 -= 8; if ( v84 != *v85 ) goto LABEL_189; } } v44 = 0; if ( *v25 ) goto LABEL_66; goto LABEL_28; } LABEL_66: if ( !*(_WORD *)(*(_QWORD *)(v28 + 8LL * v44) + 24LL) ) goto LABEL_75; if ( v27 > 0x143 ) { if ( v27 == 338 ) goto LABEL_74; if ( v27 > 0x152 ) { if ( v27 - 32997 <= 1 ) goto LABEL_74; goto LABEL_28; } if ( v27 > 0x145 ) goto LABEL_28; } else { if ( v27 >= 0x142 ) goto LABEL_74; if ( v27 != 273 ) { if ( v27 <= 0x111 ) { if ( v27 - 256 <= 1 ) goto LABEL_74; goto LABEL_28; } if ( v27 != 279 ) { if ( v27 == 284 || v27 == 278 ) { LABEL_74: if ( !(unsigned int)sub_C3879C(a1, v25, 0) ) goto LABEL_44; LABEL_75: *v25 = 0; goto LABEL_28; } goto LABEL_28; } } } v45 = *(_WORD *)(*(_QWORD *)(v28 + 8LL * v44) + 24LL); *(_QWORD *)(a1 + 8LL * (v45 >> 5) + 56) |= 1LL << (v45 & 0x1F); goto LABEL_28; } while ( --v32 ) { v43 = *(_DWORD **)(v41 - 16); v41 -= 8; if ( v42 != *v43 ) goto LABEL_81; } } v44 = 0; goto LABEL_66; } LABEL_28: v25 += 12; if ( v25 != v26 ) continue; break; } if ( *(_WORD *)(a1 + 120) == 6 && *(_WORD *)(a1 + 170) == 2 ) { if ( !(unsigned int)TIFFFillStriles() ) goto LABEL_44; v80 = (char *)p; v81 = (char *)p + v16; v82 = (char *)p; while ( *(_WORD *)v82 != 273 ) { v82 += 24; if ( v82 == v81 ) goto LABEL_84; } if ( *((_QWORD *)v82 + 1) == 1 ) { while ( *(_WORD *)v80 != 279 ) { v80 += 24; if ( v81 == v80 ) goto LABEL_84; } if ( *((_QWORD *)v80 + 1) == 1 ) { *(_WORD *)(a1 + 170) = 1; TIFFWarningExt( *(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Planarconfig tag value assumed incorrect, assuming data is contig instead of chunky"); } } } LABEL_84: v46 = *(_QWORD *)(a1 + 56); if ( (v46 & 2) == 0 ) { TIFFErrorExt( *(_QWORD *)(a1 + 952), "MissingRequired", "TIFF directory is missing required \"%s\" field", "ImageLength"); goto LABEL_44; } if ( (v46 & 4) != 0 ) { v47 = TIFFNumberOfTiles(a1); *(_DWORD *)(a1 + 228) = v47; v49 = *(_DWORD *)(a1 + 16) | 0x400; } else { v47 = TIFFNumberOfStrips(a1); *(_DWORD *)(a1 + 228) = v47; v48 = *(_DWORD *)(a1 + 132); v49 = *(_DWORD *)(a1 + 16) & 0xFFFFFBFF; v50 = *(_DWORD *)(a1 + 96); *(_DWORD *)(a1 + 100) = *(_DWORD *)(a1 + 88); *(_DWORD *)(a1 + 104) = v48; *(_DWORD *)(a1 + 108) = v50; } *(_DWORD *)(a1 + 16) = v49; if ( !v47 ) { if ( (v49 & 0x400) != 0 ) v51 = "tiles"; else v51 = "strips"; TIFFErrorExt(*(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Cannot handle zero number of %s", v51); goto LABEL_44; } v57 = *(unsigned __int16 *)(a1 + 170); *(_DWORD *)(a1 + 224) = v47; if ( v57 == 2 ) *(_DWORD *)(a1 + 224) = v47 / *(unsigned __int16 *)(a1 + 130); v58 = *(_QWORD *)(a1 + 56); if ( (v58 & 0x2000000) == 0 ) { v59 = v49 & 0x400; if ( *(_WORD *)(a1 + 120) != 6 || v59 || v47 != 1 ) { if ( v59 ) v60 = "TileOffsets"; else v60 = "StripOffsets"; TIFFErrorExt(*(_QWORD *)(a1 + 952), "MissingRequired", "TIFF directory is missing required \"%s\" field", v60); goto LABEL_44; } *(_QWORD *)(a1 + 56) = v58 | 0x2000000; } v61 = (char *)p; v62 = (char *)p + v16; while ( 2 ) { v63 = *(unsigned __int16 *)v61; if ( v63 == 301 ) goto LABEL_138; if ( v63 <= 0x12D ) { if ( v63 == 273 ) goto LABEL_160; if ( v63 > 0x111 ) { if ( v63 == 279 ) { LABEL_136: if ( !(unsigned int)sub_C3AD98( a1, (unsigned __int16 *)v61, *(_DWORD *)(a1 + 228), (unsigned __int64 *)(a1 + 240)) ) goto LABEL_44; goto LABEL_122; } if ( v63 < 0x117 || v63 > 0x119 ) goto LABEL_130; } else { if ( v63 == 255 ) { if ( *((_QWORD *)v61 + 1) == 1 && !(unsigned int)sub_C35288(a1, (__int64)v61, &v118) && ((unsigned __int16)v118 == 2 || (unsigned __int16)v118 == 3) ) { TIFFSetField((const char **)a1, 254); } goto LABEL_122; } if ( v63 != 258 ) { if ( *(_WORD *)v61 ) goto LABEL_130; goto LABEL_122; } } LABEL_149: v77 = *((_QWORD *)v61 + 1); if ( v77 == 1 ) { v64 = sub_C35288(a1, (__int64)v61, &v118); if ( v64 != 1 ) { LABEL_196: if ( v64 ) goto LABEL_152; if ( !(unsigned int)TIFFSetField((const char **)a1, *(unsigned __int16 *)v61, (unsigned __int16)v118) ) goto LABEL_44; goto LABEL_122; } v77 = *((_QWORD *)v61 + 1); } if ( *(unsigned __int16 *)(a1 + 130) > v77 ) { v64 = 1; LABEL_152: v78 = TIFFFieldWithTag((_QWORD *)a1, *(unsigned __int16 *)v61); if ( v78 ) { LABEL_153: v79 = *((const char **)v78 + 4); goto LABEL_154; } LABEL_193: v79 = "unknown tagname"; LABEL_154: sub_C34BEC((_QWORD *)(a1 + 952), v64, (__int64)"TIFFReadDirectory", (__int64)v79, 0); LABEL_44: if ( p ) TIFFfree(p); return 0; } v64 = sub_C3B530(a1, (__int64)v61, &v118); goto LABEL_196; } if ( v63 == 339 ) goto LABEL_149; if ( v63 > 0x153 ) { if ( v63 <= 0x155 ) { if ( *((_QWORD *)v61 + 1) != *(unsigned __int16 *)(a1 + 130) ) { v64 = 1; goto LABEL_192; } v64 = sub_C362A0(a1, (__int64)v61, (float **)&v118); if ( v64 ) { v63 = *(unsigned __int16 *)v61; LABEL_192: v78 = TIFFFieldWithTag((_QWORD *)a1, v63); if ( v78 ) goto LABEL_153; goto LABEL_193; } v65 = *(_DWORD *)(a1 + 16); v66 = *(unsigned __int16 *)v61; v67 = v118; *(_DWORD *)(a1 + 16) = v65 | 0x400000; v68 = TIFFSetField((const char **)a1, v66, v67); v69 = v118; *(_DWORD *)(a1 + 16) = v65; TIFFfree(v69); if ( !v68 ) goto LABEL_44; goto LABEL_122; } if ( v63 == 32996 ) goto LABEL_149; LABEL_130: sub_C3879C(a1, (unsigned __int16 *)v61, 1); goto LABEL_122; } if ( v63 == 324 ) { LABEL_160: if ( !(unsigned int)sub_C3AD98(a1, (unsigned __int16 *)v61, *(_DWORD *)(a1 + 228), (unsigned __int64 *)(a1 + 232)) ) goto LABEL_44; goto LABEL_122; } if ( v63 == 325 ) goto LABEL_136; if ( v63 != 320 ) goto LABEL_130; LABEL_138: v70 = *(_WORD *)(a1 + 116); v118 = nullptr; v71 = 1LL << v70; v72 = *((_QWORD *)v61 + 1); v73 = v71; if ( v63 == 301 && v72 == (unsigned int)v71 ) v73 = 0; else LODWORD(v71) = 3 * v71; v74 = 1; if ( v72 == (unsigned int)v71 ) { v74 = sub_C37ED0(a1, (__int64)v61, (unsigned __int8 **)&v118); if ( v74 ) { v63 = *(unsigned __int16 *)v61; goto LABEL_141; } TIFFSetField( (const char **)a1, *(unsigned __int16 *)v61, v118, (char *)v118 + 2 * v73, (char *)v118 + 4 * (v73 & 0x7FFFFFFF)); TIFFfree(v118); } else { LABEL_141: v75 = TIFFFieldWithTag((_QWORD *)a1, v63); if ( v75 ) v76 = *((const char **)v75 + 4); else v76 = "unknown tagname"; sub_C34BEC((_QWORD *)(a1 + 952), v74, (__int64)"TIFFReadDirectory", (__int64)v76, 1); } LABEL_122: v61 += 24; if ( v61 != v62 ) continue; break; } if ( *(_WORD *)(a1 + 120) == 6 ) { v112 = *(_QWORD *)(a1 + 56); if ( (v112 & 0x100) != 0 ) { if ( *(_WORD *)(a1 + 122) != 2 ) goto LABEL_257; v116 = *(_QWORD *)(a1 + 952); *(_WORD *)(a1 + 122) = 6; TIFFWarningExt( v116, "TIFFReadDirectory", "Photometric tag value assumed incorrect, assuming data is YCbCr instead of RGB"); } else { TIFFWarningExt(*(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Photometric tag is missing, assuming data is YCbCr"); if ( !(unsigned int)TIFFSetField((const char **)a1, 262, 6) ) goto LABEL_44; } v112 = *(_QWORD *)(a1 + 56); LABEL_257: if ( (v112 & 0x40) == 0 ) { TIFFWarningExt( *(_QWORD *)(a1 + 952), "TIFFReadDirectory", "BitsPerSample tag is missing, assuming 8 bits per sample"); if ( !(unsigned int)TIFFSetField((const char **)a1, 258, 8) ) goto LABEL_44; v112 = *(_QWORD *)(a1 + 56); } if ( (v112 & 0x10000) == 0 ) { v113 = *(unsigned __int16 *)(a1 + 122); if ( v113 == 2 ) { TIFFWarningExt( *(_QWORD *)(a1 + 952), "TIFFReadDirectory", "SamplesPerPixel tag is missing, assuming correct SamplesPerPixel value is 3"); if ( !(unsigned int)TIFFSetField((const char **)a1, 277, 3) ) goto LABEL_44; v113 = *(unsigned __int16 *)(a1 + 122); } if ( v113 == 6 ) { TIFFWarningExt( *(_QWORD *)(a1 + 952), "TIFFReadDirectory", "SamplesPerPixel tag is missing, applying correct SamplesPerPixel value of 3"); if ( !(unsigned int)TIFFSetField((const char **)a1, 277, 3) ) goto LABEL_44; } else { if ( v113 > 1 ) goto LABEL_262; if ( !(unsigned int)TIFFSetField((const char **)a1, 277, 1) ) goto LABEL_44; } } v113 = *(unsigned __int16 *)(a1 + 122); LABEL_262: if ( v113 == 3 ) goto LABEL_263; goto LABEL_267; } if ( *(_WORD *)(a1 + 122) != 3 ) goto LABEL_39; LABEL_263: if ( (*(_QWORD *)(a1 + 56) & 0x4000000) == 0 ) { if ( *(unsigned __int16 *)(a1 + 116) <= 7u ) { TIFFErrorExt( *(_QWORD *)(a1 + 952), "MissingRequired", "TIFF directory is missing required \"%s\" field", "Colormap"); goto LABEL_44; } if ( *(_WORD *)(a1 + 130) == 3 ) *(_WORD *)(a1 + 122) = 2; else *(_WORD *)(a1 + 122) = 1; } LABEL_267: if ( *(_WORD *)(a1 + 120) != 6 ) { LABEL_39: if ( (*(_QWORD *)(a1 + 56) & 0x1000000) != 0 ) { if ( *(_DWORD *)(a1 + 228) == 1 && (unsigned int)TIFFFillStriles() && **(_QWORD **)(a1 + 232) && ((v114 = **(_QWORD **)(a1 + 240)) == 0 || *(_WORD *)(a1 + 120) == 1 && (v114 > (*(__int64 (__fastcall **)(_QWORD))(a1 + 992))(*(_QWORD *)(a1 + 952)) - **(_QWORD **)(a1 + 232) || !*(_DWORD *)(a1 + 12) && *(_WORD *)(a1 + 120) == 1 && (v115 = **(_QWORD **)(a1 + 240), v115 < TIFFScanlineSize64(a1) * (unsigned __int64)*(unsigned int *)(a1 + 92)))) ) { TIFFWarningExt( *(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Bogus \"StripByteCounts\" field, ignoring and calculating from imagelength"); } else { if ( *(_WORD *)(a1 + 170) != 1 ) goto LABEL_205; if ( *(_DWORD *)(a1 + 228) <= 2u ) goto LABEL_205; if ( *(_WORD *)(a1 + 120) != 1 ) goto LABEL_205; v109 = *(__int64 **)(a1 + 240); v110 = *v109; v111 = v109[1]; if ( v110 == v111 || v110 == 0 || !v111 ) goto LABEL_205; TIFFWarningExt( *(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Wrong \"StripByteCounts\" field, ignoring and calculating from imagelength"); } } else { v36 = *(unsigned __int16 *)(a1 + 170); if ( v36 == 1 ) { if ( *(_DWORD *)(a1 + 228) > 1u ) { LABEL_43: TIFFErrorExt( *(_QWORD *)(a1 + 952), "MissingRequired", "TIFF directory is missing required \"%s\" field", "StripByteCounts"); goto LABEL_44; } } else if ( v36 == 2 && *(_DWORD *)(a1 + 228) != *(unsigned __int16 *)(a1 + 130) ) { goto LABEL_43; } TIFFWarningExt( *(_QWORD *)(a1 + 952), "TIFFReadDirectory", "TIFF directory is missing required \"StripByteCounts\" field, calculating from imagelength"); } if ( (sub_4DEBB8(a1, (__int64)p, v12) & 0x80000000) != 0 ) goto LABEL_44; } LABEL_205: if ( p ) { TIFFfree(p); p = nullptr; } if ( (*(_QWORD *)(a1 + 56) & 0x80000) == 0 ) { v86 = *(unsigned __int16 *)(a1 + 116); if ( v86 <= 0xF ) *(_WORD *)(a1 + 138) = (1LL << v86) - 1; else *(_WORD *)(a1 + 138) = -1; } v87 = *(_DWORD *)(a1 + 228); if ( v87 > 1 ) { v88 = v87 - 2; v89 = *(unsigned __int64 **)(a1 + 232); *(_DWORD *)(a1 + 248) = 1; v90 = &v89[v88 + 2]; v93 = *v89; v91 = v89 + 1; v92 = v93; while ( 1 ) { v94 = *v91++; v95 = v94 >= v92; v92 = v94; if ( !v95 ) break; if ( v91 == v90 ) goto LABEL_215; } *(_DWORD *)(a1 + 248) = 0; } LABEL_215: (*(void (__fastcall **)(__int64))(a1 + 704))(a1); if ( *(_WORD *)(a1 + 170) != 1 ) goto LABEL_217; if ( *(_DWORD *)(a1 + 228) != 1 ) goto LABEL_217; v99 = *(unsigned __int16 *)(a1 + 120); if ( v99 != 1 ) goto LABEL_217; v96 = *(_DWORD *)(a1 + 16); if ( (v96 & 0x8400) == 0x8000 ) { if ( !(unsigned int)TIFFFillStriles() ) return 0; v100 = *(unsigned __int64 **)(a1 + 240); if ( !v100 ) return 0; v101 = *v100; v102 = **(_QWORD **)(a1 + 232); if ( *(_WORD *)(a1 + 122) == 6 && (*(_DWORD *)(a1 + 16) & 0x4000) == 0 ) v99 = *(unsigned __int16 *)(a1 + 266); v103 = TIFFVTileSize64(a1, v99); v104 = v103; if ( v103 > 0x2000 ) { LABEL_230: if ( *(_DWORD *)(a1 + 132) <= v99 ) goto LABEL_217; v105 = (v101 - 1 + v104) / v104; if ( v105 - 1 > 0xFFFFFFFE ) goto LABEL_217; v106 = TIFFCheckMalloc((_QWORD *)a1, (v101 - 1 + v104) / v104, 8, "for chopped \"StripByteCounts\" array"); v107 = TIFFCheckMalloc((_QWORD *)a1, (v101 - 1 + v104) / v104, 8, "for chopped \"StripOffsets\" array"); if ( !v107 || (v108 = 0, !v106) ) { if ( v106 ) TIFFfree(v106); if ( v107 ) TIFFfree(v107); goto LABEL_217; } do { if ( v104 > v101 ) v104 = v101; *((_QWORD *)v106 + v108) = v104; *((_QWORD *)v107 + v108++) = v102; v102 += v104; v101 -= v104; } while ( (unsigned int)v105 > (unsigned int)v108 ); *(_DWORD *)(a1 + 228) = v105; *(_DWORD *)(a1 + 224) = v105; TIFFSetField((const char **)a1, 278, v99); TIFFfree(*(void **)(a1 + 240)); TIFFfree(*(void **)(a1 + 232)); v96 = *(_DWORD *)(a1 + 16); *(_QWORD *)(a1 + 240) = v106; *(_QWORD *)(a1 + 232) = v107; *(_DWORD *)(a1 + 248) = 1; } else { if ( v103 ) { v99 *= 0x2000 / v103; v104 = v103 * (0x2000 / v103); goto LABEL_230; } LABEL_217: v96 = *(_DWORD *)(a1 + 16); } } *(_DWORD *)(a1 + 636) = -1; *(_DWORD *)(a1 + 644) = -1; *(_DWORD *)(a1 + 16) = v96 & 0xFFDFFFF7; *(_DWORD *)(a1 + 680) = -1; *(_DWORD *)(a1 + 684) = -1; *(_QWORD *)(a1 + 688) = -1; v97 = TIFFScanlineSize(a1); *(_QWORD *)(a1 + 856) = v97; if ( v97 ) { if ( (*(_DWORD *)(a1 + 16) & 0x400) != 0 ) { v98 = TIFFTileSize(a1); *(_QWORD *)(a1 + 688) = v98; if ( !v98 ) { TIFFErrorExt(*(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Cannot handle zero tile size"); return 0; } } else if ( !TIFFStripSize(a1) ) { TIFFErrorExt(*(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Cannot handle zero strip size"); return 0; } return 1; } TIFFErrorExt(*(_QWORD *)(a1 + 952), "TIFFReadDirectory", "Cannot handle zero scanline size"); return 0; }
GD Web Decomp Icon

GD Web Decomp

Raw Source