Skip to content

Commit

Permalink
Check string length before trying to resize it
Browse files Browse the repository at this point in the history
  • Loading branch information
asmaloney committed Sep 10, 2018
1 parent 9d46abb commit 467db84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion exif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ IFEntry parseIFEntry_temp(const unsigned char *buf, const unsigned offs,
}
// and cut zero byte at the end, since we don't want that in the
// std::string
if (result.val_string()[result.val_string().length() - 1] == '\0') {
if (result.length() && result.val_string()[result.val_string().length() - 1] == '\0') {
result.val_string().resize(result.val_string().length() - 1);
}
break;
Expand Down

0 comments on commit 467db84

Please sign in to comment.