Loading media/java/android/media/ExifInterface.java +2 −8 Original line number Diff line number Diff line Loading @@ -1191,10 +1191,6 @@ public class ExifInterface { ++bytesRead; while (true) { marker = dataInputStream.readByte(); if (marker == -1) { Log.w(TAG, "Reading JPEG has ended unexpectedly"); break; } if (marker != MARKER) { throw new IOException("Invalid marker:" + Integer.toHexString(marker & 0xff)); } Loading Loading @@ -1329,10 +1325,6 @@ public class ExifInterface { while (true) { byte marker = dataInputStream.readByte(); if (marker == -1) { Log.w(TAG, "Reading JPEG has ended unexpectedly"); break; } if (marker != MARKER) { throw new IOException("Invalid marker"); } Loading @@ -1357,6 +1349,8 @@ public class ExifInterface { } } // Copy non-EXIF APP1 segment. dataOutputStream.writeByte(MARKER); dataOutputStream.writeByte(marker); dataOutputStream.writeUnsignedShort(length + 2); if (length >= 6) { length -= 6; Loading media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/ExifInterfaceTest.java +5 −3 Original line number Diff line number Diff line Loading @@ -417,13 +417,15 @@ public class ExifInterfaceTest extends AndroidTestCase { testExifInterfaceForRaw(LG_G4_ISO_800_DNG, R.array.lg_g4_iso_800_dng); } public void testCorruptedImage() throws Throwable { public void testDoNotFailOnCorruptedImage() throws Throwable { // To keep the compatibility with old versions of ExifInterface, even on a corrupted image, // it shouldn't raise any exceptions except an IOException when unable to open a file. byte[] bytes = new byte[1024]; try { new ExifInterface(new ByteArrayInputStream(bytes)); fail("Should not reach here!"); // Always success } catch (IOException e) { // Success fail("Should not reach here!"); } } Loading Loading
media/java/android/media/ExifInterface.java +2 −8 Original line number Diff line number Diff line Loading @@ -1191,10 +1191,6 @@ public class ExifInterface { ++bytesRead; while (true) { marker = dataInputStream.readByte(); if (marker == -1) { Log.w(TAG, "Reading JPEG has ended unexpectedly"); break; } if (marker != MARKER) { throw new IOException("Invalid marker:" + Integer.toHexString(marker & 0xff)); } Loading Loading @@ -1329,10 +1325,6 @@ public class ExifInterface { while (true) { byte marker = dataInputStream.readByte(); if (marker == -1) { Log.w(TAG, "Reading JPEG has ended unexpectedly"); break; } if (marker != MARKER) { throw new IOException("Invalid marker"); } Loading @@ -1357,6 +1349,8 @@ public class ExifInterface { } } // Copy non-EXIF APP1 segment. dataOutputStream.writeByte(MARKER); dataOutputStream.writeByte(marker); dataOutputStream.writeUnsignedShort(length + 2); if (length >= 6) { length -= 6; Loading
media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/ExifInterfaceTest.java +5 −3 Original line number Diff line number Diff line Loading @@ -417,13 +417,15 @@ public class ExifInterfaceTest extends AndroidTestCase { testExifInterfaceForRaw(LG_G4_ISO_800_DNG, R.array.lg_g4_iso_800_dng); } public void testCorruptedImage() throws Throwable { public void testDoNotFailOnCorruptedImage() throws Throwable { // To keep the compatibility with old versions of ExifInterface, even on a corrupted image, // it shouldn't raise any exceptions except an IOException when unable to open a file. byte[] bytes = new byte[1024]; try { new ExifInterface(new ByteArrayInputStream(bytes)); fail("Should not reach here!"); // Always success } catch (IOException e) { // Success fail("Should not reach here!"); } } Loading