Fix OOB string access (fixes #5207)

This commit is contained in:
Flössie 2019-03-11 21:09:57 +01:00
parent 038207235e
commit 86690f1ca0

View File

@ -450,10 +450,18 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
found = true; found = true;
lens = "Canon " + ldata; lens = "Canon " + ldata;
} }
} else {
found = lens_from_make_and_model();
} }
} }
if( !found || lens.substr(lens.find(' ')).length() < 7 ) { const std::string::size_type first_space_pos = lens.find(' ');
const std::string::size_type remaining_size =
first_space_pos != std::string::npos
? lens.size() - first_space_pos
: 0;
if( !found || remaining_size < 7U ) {
lt = mnote->findTag("LensID"); lt = mnote->findTag("LensID");
if ( lt ) { if ( lt ) {
@ -464,10 +472,6 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
} }
} }
} }
if (!found) {
lens_from_make_and_model();
}
} else if (!make.compare (0, 6, "PENTAX") || (!make.compare (0, 5, "RICOH") && !model.compare (0, 6, "PENTAX"))) { } else if (!make.compare (0, 6, "PENTAX") || (!make.compare (0, 5, "RICOH") && !model.compare (0, 6, "PENTAX"))) {
// ISO at max value supported, check manufacturer specific // ISO at max value supported, check manufacturer specific
if (iso_speed == 65535 || iso_speed == 0) { if (iso_speed == 65535 || iso_speed == 0) {