未验证 提交 7e958646 编写于 作者: E Ebrahim Byagowi 提交者: GitHub

[CPAL] Fix version checking logic on sanitizer (#851)

上级 bcf578fe
...@@ -89,7 +89,6 @@ struct CPALV1Tail ...@@ -89,7 +89,6 @@ struct CPALV1Tail
LOffsetTo<HBUINT32> paletteFlags; LOffsetTo<HBUINT32> paletteFlags;
LOffsetTo<HBUINT16> paletteLabel; LOffsetTo<HBUINT16> paletteLabel;
LOffsetTo<HBUINT16> paletteEntryLabel; LOffsetTo<HBUINT16> paletteEntryLabel;
public: public:
DEFINE_SIZE_STATIC (12); DEFINE_SIZE_STATIC (12);
}; };
...@@ -113,13 +112,12 @@ struct CPAL ...@@ -113,13 +112,12 @@ struct CPAL
if (colorRecordIndices[i] + numPaletteEntries > colorRecords.get_size ()) if (colorRecordIndices[i] + numPaletteEntries > colorRecords.get_size ())
return_trace (false); return_trace (false);
if (version > 1) // If version is zero, we are done here; otherwise we need to check tail also
{ if (version == 0)
const CPALV1Tail &v1 = StructAfter<CPALV1Tail> (*this);
return_trace (v1.sanitize (c, palettes));
}
else
return_trace (true); return_trace (true);
const CPALV1Tail &v1 = StructAfter<CPALV1Tail> (*this);
return_trace (v1.sanitize (c, palettes));
} }
inline unsigned int get_size (void) const inline unsigned int get_size (void) const
...@@ -158,7 +156,7 @@ struct CPAL ...@@ -158,7 +156,7 @@ struct CPAL
HBUINT16 numPalettes; HBUINT16 numPalettes;
ArrayOf<ColorRecord> colorRecords; ArrayOf<ColorRecord> colorRecords;
HBUINT16 colorRecordIndices[VAR]; // VAR=numPalettes HBUINT16 colorRecordIndices[VAR]; // VAR=numPalettes
/*CPALV1Tail v1[VAR];*/
public: public:
DEFINE_SIZE_ARRAY (12, colorRecordIndices); DEFINE_SIZE_ARRAY (12, colorRecordIndices);
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册