Fix bug 70042

This commit is contained in:
Svetlana Kulikova
2024-09-23 19:08:27 +03:00
parent 30868b81bc
commit f0f4e39f5c
2 changed files with 53 additions and 4 deletions

View File

@ -238,11 +238,24 @@ bool COfficeFileFormatChecker::isPdfFormatFile(unsigned char *pBuffer, int dwByt
if (NULL == pFirst)
{
//skip special
_UINT16 sz = pBuffer[0] + (pBuffer[1] << 8);
if (sz < dwBytes - 8)
char* pData = (char*)pBuffer;
for (int i = 0; i < dwBytes - 5; ++i)
{
pFirst = strstr((char*)(pBuffer + sz), "%PDF-");
int nPDF = strncmp(&pData[i], "%PDF-", 5);
if (!nPDF)
{
pFirst = (char*)pBuffer + i;
break;
}
}
if (NULL == pFirst)
{
//skip special
_UINT16 sz = pBuffer[0] + (pBuffer[1] << 8);
if (sz < dwBytes - 8)
{
pFirst = strstr((char*)(pBuffer + sz), "%PDF-");
}
}
}
if (NULL != pFirst)