Some sniffers in MediaExtractor might issue reads past the end of
the file. This results in IOException in our MediaDataSource. The
exception itself is not fatal, but need to make sure MediaDataSource
state is kept in sync otherwise the other extractors can't continue.
Bug: 79497983
Test: test the ExifInterface on the attached file in bug, as well as
selected HEIF files from other devices, Exif should be extracted
without error in the log.
Change-Id: I5c8f597b8ef14288e3465670b202adc93c09e6ea
A corrupted image file may create two problems.
1. A corrupted IFD pointer may point to an IFD that has already
been read, thus creating an infinite loop and a stack overflow.
2. A corrupted IFD offset value may have a negative value, thus
prompting a random reading of the file and creating an infinite
loop.
This CL addresses these issues.
Bug: 63800695
Test: Run cts (ExifInterfaceTest)
Change-Id: I706a0c3eae6af8301af69407333ea88e5681df3c
Query the extractor for the exif data offset and length,
if it's available, read the exif block from the file.
Otherwise, set image dimension and rotation only.
bug: 76149934
Change-Id: I85f24b526fb356a9227941e20807fc96369c8536
This CL removes code that directly casts int[] to long[] and instead
iterates through the individual values and casts to int if necessary.
They are cast to integer because StripOffsets/StripByteCounts
Attributes can return either int[] or long[] values, but the maximum
length of a file that ExifInterface can handle is the maximum value
of integer, so it should be safe to cast the long values to integer
values.
Bug: 73091048
Test: Cts
Change-Id: I9f3b98204e0829a8a8a30927bb8c0a698c457654
If the file has both image and video, prefer image info over
video info. App querying ExifInterface is most likely using
the bitmap path which picks the image first.
bug: 63633199
Test:
tested querying the rotation info in own test app.
Change-Id: I955b27c2ad699d4895e171053ea27b62e779db2b
MediaMetadataRetriever now reports rotation in clockwise,
no longer need to translate.
bug: 67470228
Test: verified rotation using test app attached in bug
Change-Id: Ifebcf25ea302477818e2e03db1e55525db985e67
ExifInterface reads the first 5000 bytes of an image file to
determine what type of image it is, and throws an EOFException
if the file is smaller 5000 bytes. This CL removes the throwing
action.
Bug: 64133582
Test: Run ExifInterfaceTest.java with <5kb file
Change-Id: I2b2026f06d70a4fe2986d2e8c410679ba9bf3f7f
In this CL, we add two public static final Strings to MetadataReader. I
use these to put in an "extras" bundle into our highest level bundle.
Within that extras bundle is the Latitude and Longitude values, if
available.
Bug: 63906073
Test: In Place
Change-Id: I1feccb4444d6525f9bc8bddfe8cc73b098e0b90e
Although the DATETIME and DATETIME_ORIGINAL tags are for different
purposes, the DATETIME value is set to the same value as
DATETIME_ORIGINAL tag's when loading the attributes of an image.
This CL prevents the problem by setting the value of DATETIME tag only
when it does not exist.
Bug: 62137632
Test: Passed ExifInterface CTS
Change-Id: Ic5c43c53cb363a782bcac20915d74ea534ec70e4
Exifinterface sets the thumbnail's compression information as JPEG
whenever the image has no compression tag in it. As a result, even
an image with no thumbnail can have the thumbnail compression info.
This CL fixes the problem.
Test: Run CTS test on angler
Change-Id: I4b06956b1bac672e1bf235df6f458b31e8ee82bb
Prior to android N, ExifInterface.setAttributes() accepted the
decimal values for SRATIONAL/URATIONAL formats. However in android N,
decimal values for RATIONAL formats are rejected. Since this behavior
breaks the backward compatibility, we should make setAttributes()
accept decimal values as before.
Bug: 34269464
Test: flashed modified build on angler and tested with an app
Change-Id: I9a77ce341c8c8c3ea74c8592b5a821243eb0257d
The IFD entry has a 4-byte field COUNT. It is read as int type
and is used as array size by ExifInterface. If a crafted JPEG
file contains a negative value, a NegativeArraySizeException
occurs.
Test: passed ExifInterface CTS
Change-Id: Ief29936400f04636928df09e7f357cbf25345383
Signed-off-by: NIEJuhu <niejuhu@xiaomi.com>
ExifInterface object can be created with a unsupported file format.
If saveAttribute is called with an unsupported file format, ExifInterface
makes the file corrupted. This CL prevents those cases by throwing
an exception before making any change on the file.
Bug: 30936376
Change-Id: I115a42601c774062485974042464abb0d65c35e9
(cherry picked from commit a8f9a075b1)
ExifInterface object can be created with a unsupported file format.
If saveAttribute is called with an unsupported file format, ExifInterface
makes the file corrupted. This CL prevents those cases by throwing
an exception before making any change on the file.
Bug: 30936376
Change-Id: I115a42601c774062485974042464abb0d65c35e9
ExifInterface uses a class named ByteOrderAwarenessDataInputStream
to handle LITTLE_ENDIAN byte-ordered data. This class can only be
initialized with a byte array, which is inefficient for large RAW
files. This CL adds support for initializing with an input stream.
Bug: 30749097
Change-Id: I4e95fb2157115c571ed24ec3746a3c6db752bbdc
Current code checks Pixel X/Y Dimension tags when updating primary
image size values. This creates a problem when the image data are not
placed properly (IFD_TYPE_PRIMARY may need to be swapped with
IFD_TYPE_PREVIEW). This CL moves the updating code to after the
images have been properly placed.
Bug: 29409358
Change-Id: Ia70b5b292812c1e7812e9fc8ca2434998cf1b7f9
ExifInterface uses an ambiguous term called "hint" to indicate the
type of IFD that needs to be parsed. This CL substitutes the use of
such term with IfdType class.
Bug: 30749097
Change-Id: Id97d09882f37818978b773d55846707915efeb49
This CL finalizes porting piex into ExifInterface by removing JNI
methods and class as well as methods handling data received from
JNI method calls.
Bug: 29409358
Change-Id: I8f6c761e50cb29476dc0784f58908ec35e3c70e9
DNG files have a unique way of identifying their image compression
type. This CL addresses this issue by adding support for cases
mentioned in the DNG Specifications.
Bug: 30727870
Change-Id: I416b9fb49872e9c878193f346dcaad5f45b0b995
ExifInterface calls native method to retrieve thumbnail data from an
AssetInputStream data. This CL removes that dependecy.
Bug: 29409358
Change-Id: I890b0e813733a5dcaa5480ee48e68c63fc079114
Existing code assumes that the primary image data is correctly placed.
Since this may be a mistaken assumption, this CL checks the
NewSubfilType value and updates the image size values only if the
tag value equals the original resolution image.
Bug: 29409358
Change-Id: I51cffba870ee29d76118b4c8b72290d1010c6462
An uncompressed thumbnail may use 24-bit RGB format to store image
data. This CL handles uncompressed thumbnail images and creates a
bitmap object by using the given byte data.
Bug: 28156704
Change-Id: Ie650de4398004dfa74519817e417c7002d4fbdbb
ARW, CR2, NEF, NRW, SRW have slight modifications to the data
structures described in TIFF Specifications. This CL handles these
modifications.
Bug: 29409358
Change-Id: I10c6b17a25d237b71d311705dfd80f7be783cd1d
PEF, RW2 files have unique ways of storing their data. This CL adds code
that checks whether a file is one of these formats and parses the data
according to specifications.
Bug: 29409358
Change-Id: I6c368b4865414062f9f535bf180d7d7bf6984a7d
A ORF file has a unique way of storing its data. This CL adds code
that checks whether a file is a ORF file format and parses the data
according to specifications.
Bug: 29409358
Change-Id: I498408a9e02dfe567c2d427b037c30b06af74d7e
ExifInterface currently logs exceptions when it encounters invalid
markers and when the file format is unsupported by Piex Library.
This CL suppresses such logs with the DEBUG marker.
Bug: 30252745
Change-Id: Ia69183eaa5bf7ac2ff1dc95c0919b23b4a9f8c4e
A RAF format file has a unique way of storing its data. This CL adds
code that checks whether a file is a RAF file format and parses the
data according to specifications.
Bug: 29409358
Change-Id: If37d4ba8de47cdbacd524a07148ba6c14f873259
The primary image may not contain the tags for ImageLength and
ImageWidth values if it uses the JFIF specification. This CL searches
the data to retrieve those necessary values.
Bug: 29409358
Change-Id: I850768af38b7b723e93833a70a2238f3fe1cc29b
A RAW format file may contain a preview image, in addition to a
primary image and a thumbnail image. This CL detects and parses the
preview image metadata.
Bug: 29409358
Change-Id: Ide176ea0d93228b45c50a97f82273132de25e27a
A RAW file may store extra pixels around the edges of the image,
resulting in width and length tags that are larger than they actually
are. This CL addresses this issue by finding the actual values and
updating accordingly.
Bug: 29409358
Change-Id: I804bdbd7883ea860fe3425e6ce9c71334d1341a0