Turo Lamminen
2015-05-09 002c76edb06d432fe6a5b24aff7dc8133d5d02d1
mojodds.c
@@ -214,17 +214,17 @@
    *_miplevels = (header->dwCaps & DDSCAPS_MIPMAP) ? header->dwMipMapCount : 1;
    unsigned int calculatedMipLevels = uintLog2(MAX(width, height)) + 1;
    if (*_miplevels > 32)
    {
        // too many mip levels, width and height would be larger than 32-bit int
        // file is corrupted
        return 0;
    }
    else if (*_miplevels == 0)
    if (*_miplevels == 0)
    {
        // invalid, calculate it ourselves from size
        *_miplevels = calculatedMipLevels;
    }
    else if (*_miplevels > calculatedMipLevels)
    {
        // too many mip levels, several would be 1x1
        // file is corrupted
        return 0;
    }
    if (header->ddspf.dwFlags & DDPF_FOURCC)
    {