tdf#173869: Compound File Binary version 4 rejected - PPT/DOC fail to load
Bugtracker submitted but also analyzed and with suggestion of a fix by Florian Stascheck (florian.stascheck@gmail.com) (see bugtracker for the whole analysis) Thank you to him! Edit: m_nPageSize is in fact the sector shift (see https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cfb/05060311-bfce-4b12-874d-71fd4ce63aea) so name the constants accordingly. Change-Id: Iccbad515c0cda243e1ed9eec12caf7b614215484 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211958 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
@@ -193,9 +193,11 @@ static bool isKnownSpecial(sal_Int32 nLocation)
|
||||
// Perform thorough checks also on unknown variables
|
||||
bool StgHeader::Check()
|
||||
{
|
||||
constexpr sal_Int16 SECTOR_SHIFT_V3 = 9; // 2^9 = 512 bytes per sector
|
||||
constexpr sal_Int16 SECTOR_SHIFT_V4 = 12; // 2^12 = 4096 bytes per sector
|
||||
short version = static_cast<short>( m_nVersion >> 16 );
|
||||
return memcmp( m_cSignature, cStgSignature, 8 ) == 0
|
||||
&& static_cast<short>( m_nVersion >> 16 ) == 3
|
||||
&& m_nPageSize == 9
|
||||
&& ((version == 3 && m_nPageSize == SECTOR_SHIFT_V3) || (version == 4 && m_nPageSize == SECTOR_SHIFT_V4))
|
||||
&& lcl_wontoverflow(m_nPageSize)
|
||||
&& lcl_wontoverflow(m_nDataPageSize)
|
||||
&& m_nFATSize > 0
|
||||
|
||||
Reference in New Issue
Block a user