Skip to content

Commit

Permalink
Merge pull request #4 from pushd/overflow
Browse files Browse the repository at this point in the history
Integrate upstream fix to iOS 11 parsing error
  • Loading branch information
bcherry authored Sep 30, 2017
2 parents 5966a6f + e46c37b commit 1062c75
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Srcs/common/bitstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ void BitStream::readZeroTerminatedString(string& dstString)
char currChar;

dstString.clear();
currChar = read8Bits();
while (currChar != '\0')

while (mByteOffset != getSize() && (currChar = read8Bits()) != '\0')
{
dstString += currChar;
currChar = read8Bits();
Expand Down
6 changes: 1 addition & 5 deletions Srcs/common/iteminfobox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,7 @@ void ItemInfoEntry::parseBox(BitStream& bitstr)
if (mItemType == "mime")
{
bitstr.readZeroTerminatedString(mContentType);
try {
bitstr.readZeroTerminatedString(mContentEncoding);
} catch (std::out_of_range& e) {
// Some iPhone images break here, but it's not critical to the conversion
}
bitstr.readZeroTerminatedString(mContentEncoding);
}
else if (mItemType == "uri ")
{
Expand Down

0 comments on commit 1062c75

Please sign in to comment.