what-the-bank/sources/o/Xfn.java

419 lines
19 KiB
Java

package o;
import com.drew.imaging.tiff.TiffProcessingException;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
/* loaded from: classes.dex */
public final class Xfn {
public static void c(Pmg pmg, InterfaceC1355aBp interfaceC1355aBp, int i) throws TiffProcessingException, IOException {
short a = pmg.a(i);
if (a == 19789) {
pmg.b = true;
} else {
if (a != 18761) {
throw new TiffProcessingException("Unclear distinction between Motorola/Intel byte ordering: ".concat(String.valueOf((int) a)));
}
pmg.b = false;
}
interfaceC1355aBp.e(pmg.l(i + 2));
int g = pmg.g(i + 4) + i;
if (g >= pmg.a() - 1) {
interfaceC1355aBp.a("First IFD offset is beyond the end of the TIFF data segment -- trying default offset");
g = i + 8;
}
c(interfaceC1355aBp, pmg, new HashSet(), g, i);
}
/* JADX WARN: Failed to find 'out' block for switch in B:99:0x017b. Please report as an issue. */
public static void c(InterfaceC1355aBp interfaceC1355aBp, Pmg pmg, Set<Integer> set, int i, int i2) throws IOException {
Pmg pmg2;
Boolean bool;
Boolean bool2;
int i3;
int i4;
long j;
long j2;
Pmg pmg3;
int i5;
boolean z;
boolean z2;
Pmg pmg4 = pmg;
int i6 = i;
int i7 = i2;
try {
} catch (Throwable th) {
th = th;
pmg2 = pmg4;
bool = null;
}
if (set.contains(Integer.valueOf(i))) {
interfaceC1355aBp.e();
return;
}
set.add(Integer.valueOf(i));
if (i6 >= pmg.a() || i6 < 0) {
pmg2 = pmg4;
bool = null;
try {
interfaceC1355aBp.c("Ignored IFD marked to start outside data segment");
interfaceC1355aBp.e();
return;
} catch (Throwable th2) {
th = th2;
}
} else {
int l = pmg4.l(i6);
if (l <= 255 || (l & 255) != 0) {
i3 = l;
bool2 = null;
} else {
Boolean valueOf = Boolean.valueOf(pmg4.b);
int i8 = l >> 8;
try {
pmg4.b = !pmg4.b;
i3 = i8;
bool2 = valueOf;
} catch (Throwable th3) {
th = th3;
bool = valueOf;
pmg2 = pmg4;
}
}
int i9 = i3 * 12;
try {
if (i9 + 6 + i6 > pmg.a()) {
interfaceC1355aBp.c("Illegally sized IFD");
interfaceC1355aBp.e();
if (bool2 != null) {
pmg4.b = bool2.booleanValue();
return;
}
return;
}
int i10 = 0;
int i11 = 0;
while (i10 < i3) {
int i12 = i6 + 2 + (i10 * 12);
int l2 = pmg4.l(i12);
int l3 = pmg4.l(i12 + 2);
xRm c = xRm.c(l3);
long o2 = pmg4.o(i12 + 4);
if (c == null) {
Long c2 = interfaceC1355aBp.c(l3, o2);
if (c2 == null) {
interfaceC1355aBp.c(String.format("Invalid TIFF tag format code %d for tag 0x%04X", Integer.valueOf(l3), Integer.valueOf(l2)));
int i13 = i11 + 1;
if (i13 > 5) {
interfaceC1355aBp.c("Stopping processing as too many errors seen in TIFF IFD");
interfaceC1355aBp.e();
if (bool2 != null) {
pmg4.b = bool2.booleanValue();
return;
}
return;
}
i11 = i13;
i4 = i3;
i5 = i10;
pmg3 = pmg4;
z = true;
i10 = i5 + 1;
i6 = i;
i7 = i2;
pmg4 = pmg3;
i3 = i4;
} else {
i4 = i3;
j = c2.longValue();
}
} else {
i4 = i3;
j = c.a * o2;
}
if (j > 4) {
try {
long o3 = pmg4.o(i12 + 8);
if (o3 + j > pmg.a()) {
interfaceC1355aBp.c("Illegal TIFF tag pointer offset");
i5 = i10;
pmg3 = pmg4;
z = true;
i10 = i5 + 1;
i6 = i;
i7 = i2;
pmg4 = pmg3;
i3 = i4;
} else {
j2 = i7 + o3;
}
} catch (Throwable th4) {
th = th4;
pmg2 = pmg;
}
} else {
j2 = i12 + 8;
}
if (j2 >= 0 && j2 <= pmg.a()) {
if (j >= 0 && j2 + j <= pmg.a()) {
long j3 = j;
if (j == 4 * o2) {
boolean z3 = false;
for (int i14 = 0; i14 < o2; i14++) {
if (interfaceC1355aBp.a(l2)) {
pmg2 = pmg;
try {
c(interfaceC1355aBp, pmg2, set, pmg2.g((int) ((i14 << 2) + j2)) + i7, i7);
z3 = true;
} catch (Throwable th5) {
th = th5;
}
}
}
pmg3 = pmg;
if (z3) {
i5 = i10;
z = true;
i10 = i5 + 1;
i6 = i;
i7 = i2;
pmg4 = pmg3;
i3 = i4;
}
} else {
pmg3 = pmg;
}
int i15 = (int) j2;
int i16 = (int) j3;
i5 = i10;
if (!interfaceC1355aBp.a(i15, set, i2, pmg, l2, i16)) {
int i17 = (int) o2;
switch (l3) {
case 1:
if (i17 == 1) {
interfaceC1355aBp.e(l2, pmg3.m(i15));
} else {
short[] sArr = new short[i17];
for (int i18 = 0; i18 < i17; i18++) {
sArr[i18] = pmg3.m(i15 + i18);
}
interfaceC1355aBp.d(l2, sArr);
}
z = true;
break;
case 2:
interfaceC1355aBp.c(l2, new Gux(pmg3.d(i15, i17), null));
z = true;
break;
case 3:
if (i17 == 1) {
interfaceC1355aBp.c(l2, pmg3.l(i15));
break;
} else {
int[] iArr = new int[i17];
for (int i19 = 0; i19 < i17; i19++) {
iArr[i19] = pmg3.l((i19 << 1) + i15);
}
interfaceC1355aBp.a(l2, iArr);
break;
}
case 4:
if (i17 == 1) {
interfaceC1355aBp.b(l2, pmg3.o(i15));
break;
} else {
long[] jArr = new long[i17];
for (int i20 = 0; i20 < i17; i20++) {
jArr[i20] = pmg3.o((i20 << 2) + i15);
}
interfaceC1355aBp.b(l2, jArr);
break;
}
case 5:
z2 = true;
if (i17 == 1) {
interfaceC1355aBp.c(l2, new Axo(pmg3.o(i15), pmg3.o(i15 + 4)));
break;
} else {
if (i17 > 1) {
Axo[] axoArr = new Axo[i17];
for (int i21 = 0; i21 < i17; i21++) {
int i22 = i21 << 3;
axoArr[i21] = new Axo(pmg3.o(i15 + i22), pmg3.o(i15 + 4 + i22));
}
interfaceC1355aBp.d(l2, axoArr);
break;
}
z = z2;
break;
}
case 6:
if (i17 == 1) {
interfaceC1355aBp.e(l2, pmg3.j(i15));
break;
} else {
byte[] bArr = new byte[i17];
for (int i23 = 0; i23 < i17; i23++) {
bArr[i23] = pmg3.j(i15 + i23);
}
interfaceC1355aBp.a(l2, bArr);
break;
}
case 7:
interfaceC1355aBp.e(l2, pmg3.c(i15, i17));
break;
case 8:
if (i17 == 1) {
interfaceC1355aBp.e(l2, (int) pmg3.a(i15));
break;
} else {
short[] sArr2 = new short[i17];
for (int i24 = 0; i24 < i17; i24++) {
sArr2[i24] = pmg3.a((i24 << 1) + i15);
}
interfaceC1355aBp.a(l2, sArr2);
break;
}
case 9:
if (i17 == 1) {
interfaceC1355aBp.a(l2, pmg3.g(i15));
break;
} else {
int[] iArr2 = new int[i17];
for (int i25 = 0; i25 < i17; i25++) {
iArr2[i25] = pmg3.g((i25 << 2) + i15);
}
interfaceC1355aBp.e(l2, iArr2);
break;
}
case 10:
z2 = true;
if (i17 == 1) {
interfaceC1355aBp.c(l2, new Axo(pmg3.g(i15), pmg3.g(i15 + 4)));
break;
} else {
if (i17 > 1) {
Axo[] axoArr2 = new Axo[i17];
for (int i26 = 0; i26 < i17; i26++) {
int i27 = i26 << 3;
axoArr2[i26] = new Axo(pmg3.g(i15 + i27), pmg3.g(i15 + 4 + i27));
}
interfaceC1355aBp.d(l2, axoArr2);
break;
}
z = z2;
break;
}
case 11:
if (i17 == 1) {
interfaceC1355aBp.c(l2, pmg3.e(i15));
break;
} else {
float[] fArr = new float[i17];
for (int i28 = 0; i28 < i17; i28++) {
fArr[i28] = pmg3.e((i28 << 2) + i15);
}
interfaceC1355aBp.a(l2, fArr);
break;
}
case 12:
if (i17 == 1) {
interfaceC1355aBp.b(l2, pmg3.b(i15));
break;
} else {
double[] dArr = new double[i17];
for (int i29 = 0; i29 < i17; i29++) {
dArr[i29] = pmg3.b((i29 << 3) + i15);
}
interfaceC1355aBp.d(l2, dArr);
break;
}
default:
Object[] objArr = new Object[2];
objArr[0] = Integer.valueOf(l3);
z = true;
objArr[1] = Integer.valueOf(l2);
interfaceC1355aBp.c(String.format("Invalid TIFF tag format code %d for tag 0x%04X", objArr));
break;
}
i10 = i5 + 1;
i6 = i;
i7 = i2;
pmg4 = pmg3;
i3 = i4;
}
z = true;
i10 = i5 + 1;
i6 = i;
i7 = i2;
pmg4 = pmg3;
i3 = i4;
}
pmg3 = pmg;
i5 = i10;
z = true;
StringBuilder sb = new StringBuilder();
sb.append("Illegal number of bytes for TIFF tag data: ");
sb.append(j);
interfaceC1355aBp.c(sb.toString());
i10 = i5 + 1;
i6 = i;
i7 = i2;
pmg4 = pmg3;
i3 = i4;
}
pmg3 = pmg;
i5 = i10;
z = true;
interfaceC1355aBp.c("Illegal TIFF tag pointer offset");
i10 = i5 + 1;
i6 = i;
i7 = i2;
pmg4 = pmg3;
i3 = i4;
}
pmg2 = pmg4;
int g = pmg2.g(i + 2 + i9);
if (g != 0) {
int i30 = g + i2;
if (i30 >= pmg.a()) {
interfaceC1355aBp.e();
if (bool2 != null) {
pmg2.b = bool2.booleanValue();
return;
}
return;
}
if (i30 < i) {
interfaceC1355aBp.e();
if (bool2 != null) {
pmg2.b = bool2.booleanValue();
return;
}
return;
}
if (interfaceC1355aBp.a()) {
c(interfaceC1355aBp, pmg2, set, i30, i2);
}
}
interfaceC1355aBp.e();
if (bool2 != null) {
pmg2.b = bool2.booleanValue();
return;
}
return;
} catch (Throwable th6) {
th = th6;
pmg2 = pmg4;
}
}
bool2 = bool;
interfaceC1355aBp.e();
if (bool2 != null) {
pmg2.b = bool2.booleanValue();
}
throw th;
}
}