ETCTextureDecompress 64bit crashes/black stripes

ETCTextureDecompress() internally uses “unsigned long *” to read from the source and write to the dest image with the intent to process 32-bit chunks. Unfortunately, at least on 64-bit OSX, longs are 64-bit values. This leads to reading/writing past the end of the buffers. If you are lucky, it will crash :slight_smile: If you are not, it will create an image where every odd column of pixels is the 0x00000000 from the high 4 bytes of the 8-byte longs.





This affects PVRTexLib and PVRTDecompress.cpp at least on 64-bit OSX --probably on 64-bit Linux as well.





Anyone using PVRTDecompress.cpp can easily work around the bug by editing the function to use “unsigned int” instead of “unsigned long”.

Hi Corysama,

Thanks for reporting this bug. I noticed this in other areas and have caught it in many other places, but sadly didn’t notice it here! This hasn’t made our next release but I have entered this into our internal bug tracker as high priority (id: BRN34707) and should have it fixed asap.

Thanks,

Tobias