mirror of
https://github.com/taglib/taglib.git
synced 2026-04-12 17:09:50 -04:00
Clamp oversized RIFF chunk to available bytes instead of rejecting it (#1329)
Some encoders write a valid data chunk but with a slightly too-large declared chunkSize, or place the data chunk beyond the declared RIFF boundary. The previous behaviour called break, abandoning all remaining chunks and making the file appear empty to taglib. Lenient parsers (ffmpeg, QuickTime) handle this case by clamping the chunk size to the bytes that actually remain in the file. Adopt the same strategy: when chunkSize would exceed the file length, clamp it and continue parsing rather than stopping early.
This commit is contained in:
@ -320,7 +320,7 @@ public:
|
||||
{
|
||||
FileStream stream(copy.fileName().c_str());
|
||||
stream.seek(0, IOStream::End);
|
||||
constexpr char garbage[] = "12345678";
|
||||
constexpr char garbage[] = "\r2345678";
|
||||
stream.writeBlock(ByteVector(garbage, sizeof(garbage) - 1));
|
||||
stream.seek(0);
|
||||
contentsBeforeModification = stream.readBlock(stream.length());
|
||||
|
||||
Reference in New Issue
Block a user