Turo Lamminen
2015-04-30 4e497a6e0cf6916506a78bd98df4220cfef7a226

Add sanity check for miplevels

Found with AFL

1 files modified
7 ■■■■■ changed files
mojodds.c 7 ●●●●● patch | view | raw | blame | history
mojodds.c
@@ -183,6 +183,13 @@
    *_miplevels = (header->dwCaps & DDSCAPS_MIPMAP) ? header->dwMipMapCount : 1;
    if (*_miplevels > 32)
    {
        // too many mip levels, width and height would be larger than 32-bit int
        // file is corrupted
        return 0;
    }
    if (header->ddspf.dwFlags & DDPF_FOURCC)
    {
        switch (header->ddspf.dwFourCC)