mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Fix a wrong parameter for zlib.
z_stream.avail_in has to be the length of the input buffer. It will fail when frameDataLength is smaller than the actual compressed data size.
This commit is contained in:
parent
aed689c145
commit
9d91610fc0
@ -32,7 +32,6 @@
|
||||
#endif
|
||||
|
||||
#include <bitset>
|
||||
#include <cstring>
|
||||
|
||||
#include <tdebug.h>
|
||||
#include <tstringlist.h>
|
||||
@ -255,13 +254,17 @@ ByteVector Frame::fieldData(const ByteVector &frameData) const
|
||||
if(d->header->compression() &&
|
||||
!d->header->encryption())
|
||||
{
|
||||
z_stream stream;
|
||||
::memset(&stream, 0, sizeof(z_stream));
|
||||
if(frameData.size() <= frameDataOffset) {
|
||||
debug("Compressed frame doesn't have enough data to decode");
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
z_stream stream = {};
|
||||
|
||||
if(inflateInit(&stream) != Z_OK)
|
||||
return ByteVector();
|
||||
|
||||
stream.avail_in = (uLongf) frameDataLength;
|
||||
stream.avail_in = (uLongf) frameData.size() - frameDataOffset;
|
||||
stream.next_in = (Bytef *) frameData.data() + frameDataOffset;
|
||||
|
||||
static const uint chunkSize = 1024;
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user