This bug was detected using Clang address sanitizer on Windows (version shipped with Visual Studio 2026).
The stack where the invalid read was detected was:
sinfl_read64
sinfl_refill
sinfl_decompress
sinflate
The fix was to over-allocate the buffer size to be a multiple of 8. I'm guessing this isn't normally a problem because most allocators will return blocks of multiples of 8 on 64 bit systems. In my case I was using a custom scratch allocator that poisons all leftover space that wasn't part of the initially requested size. From what I can tell, the leftover bytes do not need to be zeroed. Could you confirm this?
I'm not sure that the fix is to change reading 8 bytes at a time, which would affect performance. Perhaps just a note at the top of the file?
This bug was detected using Clang address sanitizer on Windows (version shipped with Visual Studio 2026).
The stack where the invalid read was detected was:
sinfl_read64
sinfl_refill
sinfl_decompress
sinflate
The fix was to over-allocate the buffer size to be a multiple of 8. I'm guessing this isn't normally a problem because most allocators will return blocks of multiples of 8 on 64 bit systems. In my case I was using a custom scratch allocator that poisons all leftover space that wasn't part of the initially requested size. From what I can tell, the leftover bytes do not need to be zeroed. Could you confirm this?
I'm not sure that the fix is to change reading 8 bytes at a time, which would affect performance. Perhaps just a note at the top of the file?