From b0fb749a47199c02d638da6f9716b8278fe962e7 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Wed, 26 Nov 2014 19:24:31 +0100 Subject: [PATCH] Disable a couple of sanity checks to make fuzzing more convenient --- main_u.c | 2 ++ wordole.c | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/main_u.c b/main_u.c index 4eaaea3..bc83f1d 100644 --- a/main_u.c +++ b/main_u.c @@ -182,6 +182,7 @@ bProcessFile(const char *szFilename) } iWordVersion = iGuessVersionNumber(pFile, lFilesize); +#if 0 if (iWordVersion < 0 || iWordVersion == 3) { if (bIsRtfFile(pFile)) { werr(0, "%s is not a Word Document." @@ -202,6 +203,7 @@ bProcessFile(const char *szFilename) (void)fclose(pFile); return FALSE; } +#endif /* Reset any reading done during file testing */ rewind(pFile); diff --git a/wordole.c b/wordole.c index 7797d1f..c2a6161 100644 --- a/wordole.c +++ b/wordole.c @@ -438,8 +438,10 @@ bGetDocumentText(FILE *pFile, const pps_info_type *pPPS, DBG_DEC_C(bFastSaved, uiQuickSaves); bEncrypted = (usDocStatus & BIT(8)) != 0; if (bEncrypted) { +#if 0 werr(0, "Encrypted documents are not supported"); return FALSE; +#endif } /* Get length information */ @@ -458,6 +460,7 @@ bGetDocumentText(FILE *pFile, const pps_info_type *pPPS, ulHdrTextBoxLen = ulGetLong(0x50, aucHeader); break; case 8: + default: ulTextLen = ulGetLong(0x4c, aucHeader); ulFootnoteLen = ulGetLong(0x50, aucHeader); ulHdrFtrLen = ulGetLong(0x54, aucHeader); @@ -467,9 +470,10 @@ bGetDocumentText(FILE *pFile, const pps_info_type *pPPS, ulTextBoxLen = ulGetLong(0x64, aucHeader); ulHdrTextBoxLen = ulGetLong(0x68, aucHeader); break; - default: +#if 0 werr(0, "This version of Word is not supported"); return FALSE; +#endif } DBG_DEC(ulTextLen); DBG_DEC(ulFootnoteLen); @@ -505,15 +509,17 @@ bGetDocumentText(FILE *pFile, const pps_info_type *pPPS, } break; case 8: + default: bSuccess = bGet8DocumentText(pFile, pPPS, aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); break; - default: +#if 0 werr(0, "This version of Word is not supported"); bSuccess = FALSE; break; +#endif } if (bSuccess) { @@ -598,6 +604,7 @@ vGetDocumentData(FILE *pFile, const pps_info_type *pPPS, } break; case 8: + default: /* * The data blocks are in the data stream. The data stream * is always in "normal saved" format @@ -605,10 +612,11 @@ vGetDocumentData(FILE *pFile, const pps_info_type *pPPS, bSuccess = bAddDataBlocks(0, (ULONG)LONG_MAX, pPPS->tData.ulSB, aulBBD, tBBDLen); break; - default: +#if 0 werr(0, "This version of Word is not supported"); bSuccess = FALSE; break; +#endif } if (!bSuccess) { @@ -750,10 +758,12 @@ iInitDocumentOLE(FILE *pFile, long lFilesize) if (PPS_info.tWordDocument.ulSize < MIN_SIZE_FOR_BBD_USE) { DBG_DEC(PPS_info.tWordDocument.ulSize); +#if 0 FREE_ALL(); werr(0, "I'm afraid the text stream of this file " "is too small to handle."); return -1; +#endif } /* Read the headerblock */ if (!bReadBuffer(pFile, PPS_info.tWordDocument.ulSB, @@ -772,9 +782,11 @@ iInitDocumentOLE(FILE *pFile, long lFilesize) usIdent != 0xa699); /* Word 7 for oriental languages */ iWordVersion = iGetVersionNumber(aucHeader); if (iWordVersion < 6) { +#if 0 FREE_ALL(); werr(0, "This file is from a version of Word before Word 6."); return -1; +#endif } /* Get the status flags from the header */ -- 2.1.2