Project

General

Profile

Bug #797 » tiff_composite_assertion_fix.diff

Proposed patch that forces typeSize to a safe value if we get into doCount and it's invalid. - Clint Rogers, 16 Nov 2011 13:08

View differences:

src/tiffcomposite.cpp (working copy)
1046 1046

  
1047 1047
        TypeId typeId = toTypeId(tiffType(), tag(), group());
1048 1048
        long typeSize = TypeInfo::typeSize(typeId);
1049
        assert(typeSize != 0);
1049

  
1050
	// If this isn't valid, force it to a safe value, since
1051
	// some (possibly) malformed JPEGs can cause this to be 0
1052
        if (typeSize < 1) typeSize = 1;
1053

  
1050 1054
        return static_cast<uint32_t>(static_cast<double>(size()) / typeSize + 0.5);
1051 1055
    }
1052 1056

  
(2-2/2)