-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
Hi Mayank
Thanks for the nice and lightweigtht exif library!
I just run into the situation where a 'std::length_error' on string resize was thrown. It boils down to the following line in exif.cpp:350
if (result.val_string()[result.val_string().length() - 1] == '\0') {
result.val_string().resize(result.val_string().length() - 1);
}The length of val_string() is not guaranteed to be > 0 and in my case it happend to be empty (resulting in an invalid memory access). The fix is easy:
if (!result.val_string().empty() && result.val_string()[result.val_string().length() - 1] == '\0') {
result.val_string().resize(result.val_string().length() - 1);
}Cheers & have a nice day
Alex
Metadata
Metadata
Assignees
Labels
No labels