ETCTextureDecompress 64bit crashes/black stripes

This topic contains 1 reply, has 2 voices, and was last updated by  Tobias Hector 6 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30660

    corysama
    Member

    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 🙂 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”.

    #35166

    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

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.