package o; import com.drew.metadata.MetadataException; import java.io.IOException; import o.QEQ; /* renamed from: o.lMq, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C16112lMq { public final void d(Eaa eaa, C16613piz c16613piz, boolean z) { QEQ qeq; try { int h = eaa.h(); try { if (h == 16706) { if (!z) { a("Invalid bitmap file - nested arrays not allowed", c16613piz); return; } eaa.b(4L); long f = eaa.f(); eaa.b(4L); d(eaa, c16613piz, false); if (f == 0) { return; } if (eaa.c() > f) { a("Invalid next header offset", c16613piz); return; } else { eaa.b(f - eaa.c()); d(eaa, c16613piz, true); return; } } if (h == 17225 || h == 18755 || h == 19778 || h == 20547 || h == 21584) { qeq = new QEQ(); try { c16613piz.c.add(qeq); qeq.d(-2, h); eaa.b(12L); QEQ qeq2 = qeq; b(eaa, qeq, c16613piz); return; } catch (IOException unused) { if (qeq == null) { a("Unable to read BMP file header", c16613piz); return; } else { BrP.b(new Object[]{qeq, "Unable to read BMP file header"}, -1786863991, 1786863992, System.identityHashCode(qeq)); return; } } } StringBuilder sb = new StringBuilder("Invalid BMP magic number 0x"); sb.append(Integer.toHexString(h)); c16613piz.c.add(new C17424wfl(sb.toString())); } catch (IOException unused2) { qeq = null; } } catch (IOException e) { StringBuilder sb2 = new StringBuilder("Couldn't determine bitmap type: "); sb2.append(e.getMessage()); c16613piz.c.add(new C17424wfl(sb2.toString())); } } private static void b(Eaa eaa, QEQ qeq, C16613piz c16613piz) { try { int h = qeq.h(-2); long c = eaa.c(); int a = eaa.a(); qeq.d(-1, a); if (a == 12 && h == 19778) { qeq.d(2, eaa.e()); qeq.d(1, eaa.e()); qeq.d(3, eaa.h()); qeq.d(4, eaa.h()); return; } if (a == 12) { qeq.d(2, eaa.h()); qeq.d(1, eaa.h()); qeq.d(3, eaa.h()); qeq.d(4, eaa.h()); return; } if (a == 16 || a == 64) { qeq.d(2, eaa.a()); qeq.d(1, eaa.a()); qeq.d(3, eaa.h()); qeq.d(4, eaa.h()); if (a > 16) { qeq.d(5, eaa.a()); eaa.b(4L); qeq.d(6, eaa.a()); qeq.d(7, eaa.a()); qeq.d(8, eaa.a()); qeq.d(9, eaa.a()); eaa.b(6L); qeq.d(10, eaa.h()); eaa.b(8L); qeq.d(11, eaa.a()); eaa.b(4L); return; } return; } if (a == 40 || a == 52 || a == 56 || a == 108 || a == 124) { qeq.d(2, eaa.a()); qeq.d(1, eaa.a()); qeq.d(3, eaa.h()); qeq.d(4, eaa.h()); qeq.d(5, eaa.a()); eaa.b(4L); qeq.d(6, eaa.a()); qeq.d(7, eaa.a()); qeq.d(8, eaa.a()); qeq.d(9, eaa.a()); if (a == 40) { return; } qeq.e(12, eaa.f()); qeq.e(13, eaa.f()); qeq.e(14, eaa.f()); if (a == 52) { return; } qeq.e(15, eaa.f()); if (a == 56) { return; } long f = eaa.f(); qeq.e(16, f); eaa.b(36L); qeq.e(17, eaa.f()); qeq.e(18, eaa.f()); qeq.e(19, eaa.f()); if (a == 108) { return; } qeq.d(20, eaa.a()); if (f != QEQ.LWm.PROFILE_EMBEDDED.value && f != QEQ.LWm.PROFILE_LINKED.value) { eaa.b(12L); return; } long f2 = eaa.f(); int a2 = eaa.a(); if (a2 < 0) { StringBuilder sb = new StringBuilder("Invalid profile size "); sb.append(a2); BrP.b(new Object[]{qeq, sb.toString()}, -1786863991, 1786863992, System.identityHashCode(qeq)); return; } long j = c + f2; if (eaa.c() > j) { StringBuilder sb2 = new StringBuilder("Invalid profile data offset 0x"); sb2.append(Long.toHexString(j)); BrP.b(new Object[]{qeq, sb2.toString()}, -1786863991, 1786863992, System.identityHashCode(qeq)); return; } eaa.b(j - eaa.c()); if (f == QEQ.LWm.PROFILE_LINKED.value) { qeq.e(21, new Gux(eaa.c(a2), UeM.i).toString()); return; } else { C0925RrQ c0925RrQ = new C0925RrQ(eaa.a(a2)); new GXv(); GXv.a(c0925RrQ, c16613piz); return; } } StringBuilder sb3 = new StringBuilder("Unexpected DIB header size: "); sb3.append(a); BrP.b(new Object[]{qeq, sb3.toString()}, -1786863991, 1786863992, System.identityHashCode(qeq)); } catch (MetadataException unused) { BrP.b(new Object[]{qeq, "Internal error"}, -1786863991, 1786863992, System.identityHashCode(qeq)); } catch (IOException unused2) { BrP.b(new Object[]{qeq, "Unable to read BMP header"}, -1786863991, 1786863992, System.identityHashCode(qeq)); } } private static void a(String str, C16613piz c16613piz) { C17424wfl c17424wfl = (C17424wfl) c16613piz.c(C17424wfl.class); if (c17424wfl == null) { c16613piz.c.add(new C17424wfl(str)); } else { BrP.b(new Object[]{c17424wfl, str}, -1786863991, 1786863992, System.identityHashCode(c17424wfl)); } } }