Allow EOF status after skipping chunks/trailing bytes in 3ds fies.
This shouldn't happen and I cannot reproduce it, but some people are running into issues with false positive errors.pull/1363/head
parent
5732f0b4b7
commit
8c689f752a
|
@ -136,13 +136,11 @@ bool readString(std::istream& in, std::int32_t& contentSize, std::string& value)
|
||||||
bool skipChunk(std::istream& in, M3DChunkType chunkType, std::int32_t contentSize)
|
bool skipChunk(std::istream& in, M3DChunkType chunkType, std::int32_t contentSize)
|
||||||
{
|
{
|
||||||
GetLogger()->debug("Skipping {} bytes of unknown/unexpected chunk type {}\n", contentSize, chunkType);
|
GetLogger()->debug("Skipping {} bytes of unknown/unexpected chunk type {}\n", contentSize, chunkType);
|
||||||
if (!in.ignore(contentSize).good())
|
in.ignore(contentSize);
|
||||||
{
|
if (in.good() || in.eof()) { return true; }
|
||||||
GetLogger()->error("Error skipping {} bytes of unknown/unexpected chunk type {}\n", contentSize, chunkType);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
GetLogger()->error("Error skipping {} bytes of unknown/unexpected chunk type {}\n", contentSize, chunkType);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,13 +155,11 @@ bool skipTrailing(std::istream& in, std::int32_t contentSize)
|
||||||
if (contentSize == 0) { return true; }
|
if (contentSize == 0) { return true; }
|
||||||
|
|
||||||
GetLogger()->debug("Skipping {} trailing bytes\n", contentSize);
|
GetLogger()->debug("Skipping {} trailing bytes\n", contentSize);
|
||||||
if (!in.ignore(contentSize).good())
|
in.ignore(contentSize);
|
||||||
{
|
if (in.good() || in.eof()) { return true; }
|
||||||
GetLogger()->error("Error skipping {} trailing bytes\n", contentSize);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
GetLogger()->error("Error skipping {} trailing bytes\n", contentSize);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,6 +168,12 @@ bool readChunks(std::istream& in, std::int32_t contentSize, T& obj, ProcessFunc
|
||||||
{
|
{
|
||||||
while (contentSize > chunkHeaderSize)
|
while (contentSize > chunkHeaderSize)
|
||||||
{
|
{
|
||||||
|
if (in.eof())
|
||||||
|
{
|
||||||
|
GetLogger()->warn("Unexpected EOF detected, stopping processing\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
M3DChunkType chunkType;
|
M3DChunkType chunkType;
|
||||||
if (!readChunkType(in, chunkType))
|
if (!readChunkType(in, chunkType))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue