Check Exiv2::ValueType::typeId before converting it to rational
ClosedPublic

Authored by poboiko on Feb 2 2019, 9:47 PM.

Details

Summary

If one has a malformed image with GPSAltitude key present, but is not rational,
an attempt to convert it to rational will cause a crash. Same with GPSAltitudeRef key,
(which is supposed to be a byte).

This fixes regression introduced in D16617: fix extraction of GPS altitude for exif data / D18010: Fix failing test of exiv gps data

Test Plan

I have a picture that causes baloo_file_extractor to crash, with backtrace pointing to toRational call inside fetchGpsAltitude.
It no longer crashes. Also, ctest doesn't report any oddities here.

Diff Detail

Repository
R286 KFileMetaData
Branch
invalid-gps (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 7802
Build 7820: arc lint + arc unit
poboiko created this revision.Feb 2 2019, 9:47 PM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptFeb 2 2019, 9:48 PM
poboiko requested review of this revision.Feb 2 2019, 9:48 PM
ngraham accepted this revision.Feb 2 2019, 10:53 PM
This revision is now accepted and ready to land.Feb 2 2019, 10:53 PM
This revision was automatically updated to reflect the committed changes.