mirror of https://github.com/bjornbytes/lovr.git
Probably work around stb_image bug that breaks zips;
30e01f upgraded stb_image to include its 95560b commit from its #960 pull request. This made stb_image fail more aggressively on EOF conditions when refilling huffman buffers in deflate streams. I think it might be failing _too_ aggressively, though. We are able to pad our input compressed buffers since the zip file format is guaranteed to have extra data at the end (for, e.g., the end of central directory record). This appears to be sufficient to fix compressed zip archives for the time being. It's possible that more virtual padding needs to be added, and it may be good to try to fix this in stb_image itself.
This commit is contained in:
parent
2d43620d3c
commit
0bb556554d
|
@ -571,6 +571,7 @@ static bool zip_read(Archive* archive, const char* path, size_t bytes, size_t* b
|
|||
*bytesRead = (bytes == (size_t) -1 || bytes > dstSize) ? (uint32_t) dstSize : bytes;
|
||||
|
||||
if (compressed) {
|
||||
srcSize++; // pad buffer to fix an stb_image "bug"
|
||||
if (stbi_zlib_decode_noheader_buffer(*dst, (int) dstSize, src, (int) srcSize) < 0) {
|
||||
free(*dst);
|
||||
*dst = NULL;
|
||||
|
|
Loading…
Reference in New Issue