private ExifParser( InputStream inputStream, int options, ExifInterface iRef ) throws IOException, ExifInvalidFormatException { if( inputStream == null ) { throw new IOException( "Null argument inputStream to ExifParser" ); } Log.v( TAG, "Reading exif..." ); mSections = new ArrayList<Section>(0); mInterface = iRef; mTiffStream = seekTiffData( inputStream ); mOptions = options; // Log.d( TAG, "sections size: " + mSections.size() ); if( mTiffStream == null ) { return; } parseTiffHeader( mTiffStream ); long offset = mTiffStream.readUnsignedInt(); if( offset > Integer.MAX_VALUE ) { throw new ExifInvalidFormatException( "Invalid offset " + offset ); } mIfd0Position = (int) offset; mIfdType = IfdId.TYPE_IFD_0; if( isIfdRequested( IfdId.TYPE_IFD_0 ) || needToParseOffsetsInCurrentIfd() ) { registerIfd( IfdId.TYPE_IFD_0, offset ); if( offset != DEFAULT_IFD0_OFFSET ) { mDataAboveIfd0 = new byte[(int) offset - DEFAULT_IFD0_OFFSET]; read( mDataAboveIfd0 ); } } }
long offset = mTiffStream.readUnsignedInt(); if( offset > Integer.MAX_VALUE ) { throw new ExifInvalidFormatException( "Invalid offset " + offset );
private ExifTag readTag() throws IOException, ExifInvalidFormatException { short tagId = mTiffStream.readShort(); short dataFormat = mTiffStream.readShort(); long numOfComp = mTiffStream.readUnsignedInt(); if( numOfComp > Integer.MAX_VALUE ) { throw new ExifInvalidFormatException( "Number of component is larger then Integer.MAX_VALUE" ); int dataSize = tag.getDataSize(); if( dataSize > 4 ) { long offset = mTiffStream.readUnsignedInt(); if( offset > Integer.MAX_VALUE ) { throw new ExifInvalidFormatException( "offset is larger then Integer.MAX_VALUE" );
private ExifTag readTag() throws IOException, ExifInvalidFormatException { short tagId = mTiffStream.readShort(); short dataFormat = mTiffStream.readShort(); long numOfComp = mTiffStream.readUnsignedInt(); if( numOfComp > Integer.MAX_VALUE ) { throw new ExifInvalidFormatException( "Number of component is larger then Integer.MAX_VALUE" ); int dataSize = tag.getDataSize(); if( dataSize > 4 ) { long offset = mTiffStream.readUnsignedInt(); if( offset > Integer.MAX_VALUE ) { throw new ExifInvalidFormatException( "offset is larger then Integer.MAX_VALUE" );