mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 06:34:01 +00:00
tvg format: fix broken encoding/decoding.
a regression bug was introduced by 52a7a257b2
in size calculation of data in case of uncompressed version.
@Issue: https://github.com/Samsung/thorvg/issues/739
This commit is contained in:
parent
3d80f0a9e9
commit
d599f744c8
2 changed files with 7 additions and 5 deletions
|
@ -210,12 +210,12 @@ void TvgLoader::run(unsigned tid)
|
|||
|
||||
if (compressed) {
|
||||
data = (char*) lzwDecode((uint8_t*) data, compressedSize, compressedSizeBits, uncompressedSize);
|
||||
root = interpreter->run(data, data + uncompressedSize);
|
||||
delete(data);
|
||||
} else {
|
||||
root = interpreter->run(data, this->data + size);
|
||||
}
|
||||
|
||||
root = interpreter->run(data, data + uncompressedSize);
|
||||
|
||||
if (compressed) delete(data);
|
||||
|
||||
if (!root) clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -227,9 +227,11 @@ bool TvgSaver::writeHeader()
|
|||
|
||||
//3. View Size
|
||||
writeData(vsize, SIZE(vsize));
|
||||
ptr += SIZE(vsize);
|
||||
|
||||
//4. Reserved data + Compress size
|
||||
buffer.count += TVG_HEADER_RESERVED_LENGTH + TVG_HEADER_COMPRESS_SIZE;
|
||||
memset(ptr, 0x00, TVG_HEADER_RESERVED_LENGTH + TVG_HEADER_COMPRESS_SIZE);
|
||||
buffer.count += (TVG_HEADER_RESERVED_LENGTH + TVG_HEADER_COMPRESS_SIZE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue