drewnoakes / metadata-extractor

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Apache License 2.0
2.56k stars 480 forks source link

ItemInfoBox no longer throws exception when no content encoding is present #470

Closed normana10 closed 4 years ago

normana10 commented 4 years ago

Hi Drew,

Very cool library you've made here.

I noticed that there were some silent IOExceptions being thrown when trying to extract metadata from some HEIF images I've taken.

My one comment explains what's happening pretty well. Essentially the ItemInfoBox was reading off the end of the bytes it was given because it was not taking into account that 8 bytes had already been read.

I thought I'd start small, I have another working branch that can actually pull EXIF data from HEIFs which shouldn't be impacted by the directory-per-image refactor mentioned in #445. I'll put that PR in after this one gets merged (First time contributing to open source, long time Java developer)

drewnoakes commented 4 years ago

@normana10 thanks for this, the change looks good. Do you have an image that reproduces the exception that I can add to https://github.com/drewnoakes/metadata-extractor-images for regression testing? We don't have many HEIF images.

normana10 commented 4 years ago

Added PR into metadata-extractor-images: https://github.com/drewnoakes/metadata-extractor-images/pull/33

drewnoakes commented 4 years ago

Thanks again for the test images. Ran some tests and this looks great 👍