diff --git a/libclamav/ole2_extract_images.h b/libclamav/ole2_extract_images.h index 6508c22c4c..faee581a11 100644 --- a/libclamav/ole2_extract_images.h +++ b/libclamav/ole2_extract_images.h @@ -194,192 +194,192 @@ static void copy_FibRgFcLcb97(FibRgFcLcb97 * pHeader, const uint8_t *const ptr) memcpy(pHeader, ptr, sizeof(*pHeader)); -pHeader->fcStshfOrig = ole2_endian_convert_32(pHeader->fcStshfOrig); -pHeader->lcbStshfOrig = ole2_endian_convert_32(pHeader->lcbStshfOrig); -pHeader->fcStshf = ole2_endian_convert_32(pHeader->fcStshf); -pHeader->lcbStshf = ole2_endian_convert_32(pHeader->lcbStshf); -pHeader->fcPlcffndRef = ole2_endian_convert_32(pHeader->fcPlcffndRef); -pHeader->lcbPlcffndRef = ole2_endian_convert_32(pHeader->lcbPlcffndRef); -pHeader->fcPlcffndTxt = ole2_endian_convert_32(pHeader->fcPlcffndTxt); -pHeader->lcbPlcffndTxt = ole2_endian_convert_32(pHeader->lcbPlcffndTxt); -pHeader->fcPlcfandRef = ole2_endian_convert_32(pHeader->fcPlcfandRef); -pHeader->lcbPlcfandRef = ole2_endian_convert_32(pHeader->lcbPlcfandRef); -pHeader->fcPlcfandTxt = ole2_endian_convert_32(pHeader->fcPlcfandTxt); -pHeader->lcbPlcfandTxt = ole2_endian_convert_32(pHeader->lcbPlcfandTxt); -pHeader->fcPlcfSed = ole2_endian_convert_32(pHeader->fcPlcfSed); -pHeader->lcbPlcfSed = ole2_endian_convert_32(pHeader->lcbPlcfSed); -pHeader->fcPlcPad = ole2_endian_convert_32(pHeader->fcPlcPad); -pHeader->lcbPlcPad = ole2_endian_convert_32(pHeader->lcbPlcPad); -pHeader->fcPlcfPhe = ole2_endian_convert_32(pHeader->fcPlcfPhe); -pHeader->lcbPlcfPhe = ole2_endian_convert_32(pHeader->lcbPlcfPhe); -pHeader->fcSttbfGlsy = ole2_endian_convert_32(pHeader->fcSttbfGlsy); -pHeader->lcbSttbfGlsy = ole2_endian_convert_32(pHeader->lcbSttbfGlsy); -pHeader->fcPlcfGlsy = ole2_endian_convert_32(pHeader->fcPlcfGlsy); -pHeader->lcbPlcfGlsy = ole2_endian_convert_32(pHeader->lcbPlcfGlsy); -pHeader->fcPlcfHdd = ole2_endian_convert_32(pHeader->fcPlcfHdd); -pHeader->lcbPlcfHdd = ole2_endian_convert_32(pHeader->lcbPlcfHdd); -pHeader->fcPlcfBteChpx = ole2_endian_convert_32(pHeader->fcPlcfBteChpx); -pHeader->lcbPlcfBteChpx = ole2_endian_convert_32(pHeader->lcbPlcfBteChpx); -pHeader->fcPlcfBtePapx = ole2_endian_convert_32(pHeader->fcPlcfBtePapx); -pHeader->lcbPlcfBtePapx = ole2_endian_convert_32(pHeader->lcbPlcfBtePapx); -pHeader->fcPlcfSea = ole2_endian_convert_32(pHeader->fcPlcfSea); -pHeader->lcbPlcfSea = ole2_endian_convert_32(pHeader->lcbPlcfSea); -pHeader->fcSttbfFfn = ole2_endian_convert_32(pHeader->fcSttbfFfn); -pHeader->lcbSttbfFfn = ole2_endian_convert_32(pHeader->lcbSttbfFfn); -pHeader->fcPlcfFldMom = ole2_endian_convert_32(pHeader->fcPlcfFldMom); -pHeader->lcbPlcfFldMom = ole2_endian_convert_32(pHeader->lcbPlcfFldMom); -pHeader->fcPlcfFldHdr = ole2_endian_convert_32(pHeader->fcPlcfFldHdr); -pHeader->lcbPlcfFldHdr = ole2_endian_convert_32(pHeader->lcbPlcfFldHdr); -pHeader->fcPlcfFldFtn = ole2_endian_convert_32(pHeader->fcPlcfFldFtn); -pHeader->lcbPlcfFldFtn = ole2_endian_convert_32(pHeader->lcbPlcfFldFtn); -pHeader->fcPlcfFldAtn = ole2_endian_convert_32(pHeader->fcPlcfFldAtn); -pHeader->lcbPlcfFldAtn = ole2_endian_convert_32(pHeader->lcbPlcfFldAtn); -pHeader->fcPlcfFldMcr = ole2_endian_convert_32(pHeader->fcPlcfFldMcr); -pHeader->lcbPlcfFldMcr = ole2_endian_convert_32(pHeader->lcbPlcfFldMcr); -pHeader->fcSttbfBkmk = ole2_endian_convert_32(pHeader->fcSttbfBkmk); -pHeader->lcbSttbfBkmk = ole2_endian_convert_32(pHeader->lcbSttbfBkmk); -pHeader->fcPlcfBkf = ole2_endian_convert_32(pHeader->fcPlcfBkf); -pHeader->lcbPlcfBkf = ole2_endian_convert_32(pHeader->lcbPlcfBkf); -pHeader->fcPlcfBkl = ole2_endian_convert_32(pHeader->fcPlcfBkl); -pHeader->lcbPlcfBkl = ole2_endian_convert_32(pHeader->lcbPlcfBkl); -pHeader->fcCmds = ole2_endian_convert_32(pHeader->fcCmds); -pHeader->lcbCmds = ole2_endian_convert_32(pHeader->lcbCmds); -pHeader->fcUnused1 = ole2_endian_convert_32(pHeader->fcUnused1); -pHeader->lcbUnused1 = ole2_endian_convert_32(pHeader->lcbUnused1); -pHeader->fcSttbfMcr = ole2_endian_convert_32(pHeader->fcSttbfMcr); -pHeader->lcbSttbfMcr = ole2_endian_convert_32(pHeader->lcbSttbfMcr); -pHeader->fcPrDrvr = ole2_endian_convert_32(pHeader->fcPrDrvr); -pHeader->lcbPrDrvr = ole2_endian_convert_32(pHeader->lcbPrDrvr); -pHeader->fcPrEnvPort = ole2_endian_convert_32(pHeader->fcPrEnvPort); -pHeader->lcbPrEnvPort = ole2_endian_convert_32(pHeader->lcbPrEnvPort); -pHeader->fcPrEnvLand = ole2_endian_convert_32(pHeader->fcPrEnvLand); -pHeader->lcbPrEnvLand = ole2_endian_convert_32(pHeader->lcbPrEnvLand); -pHeader->fcWss = ole2_endian_convert_32(pHeader->fcWss); -pHeader->lcbWss = ole2_endian_convert_32(pHeader->lcbWss); -pHeader->fcDop = ole2_endian_convert_32(pHeader->fcDop); -pHeader->lcbDop = ole2_endian_convert_32(pHeader->lcbDop); -pHeader->fcSttbfAssoc = ole2_endian_convert_32(pHeader->fcSttbfAssoc); -pHeader->lcbSttbfAssoc = ole2_endian_convert_32(pHeader->lcbSttbfAssoc); -pHeader->fcClx = ole2_endian_convert_32(pHeader->fcClx); -pHeader->lcbClx = ole2_endian_convert_32(pHeader->lcbClx); -pHeader->fcPlcfPgdFtn = ole2_endian_convert_32(pHeader->fcPlcfPgdFtn); -pHeader->lcbPlcfPgdFtn = ole2_endian_convert_32(pHeader->lcbPlcfPgdFtn); -pHeader->fcAutosaveSource = ole2_endian_convert_32(pHeader->fcAutosaveSource); -pHeader->lcbAutosaveSource = ole2_endian_convert_32(pHeader->lcbAutosaveSource); -pHeader->fcGrpXstAtnOwners = ole2_endian_convert_32(pHeader->fcGrpXstAtnOwners); -pHeader->lcbGrpXstAtnOwners = ole2_endian_convert_32(pHeader->lcbGrpXstAtnOwners); -pHeader->fcSttbfAtnBkmk = ole2_endian_convert_32(pHeader->fcSttbfAtnBkmk); -pHeader->lcbSttbfAtnBkmk = ole2_endian_convert_32(pHeader->lcbSttbfAtnBkmk); -pHeader->fcUnused2 = ole2_endian_convert_32(pHeader->fcUnused2); -pHeader->lcbUnused2 = ole2_endian_convert_32(pHeader->lcbUnused2); -pHeader->fcUnused3 = ole2_endian_convert_32(pHeader->fcUnused3); -pHeader->lcbUnused3 = ole2_endian_convert_32(pHeader->lcbUnused3); -pHeader->fcPlcSpaMom = ole2_endian_convert_32(pHeader->fcPlcSpaMom); -pHeader->lcbPlcSpaMom = ole2_endian_convert_32(pHeader->lcbPlcSpaMom); -pHeader->fcPlcSpaHdr = ole2_endian_convert_32(pHeader->fcPlcSpaHdr); -pHeader->lcbPlcSpaHdr = ole2_endian_convert_32(pHeader->lcbPlcSpaHdr); -pHeader->fcPlcfAtnBkf = ole2_endian_convert_32(pHeader->fcPlcfAtnBkf); -pHeader->lcbPlcfAtnBkf = ole2_endian_convert_32(pHeader->lcbPlcfAtnBkf); -pHeader->fcPlcfAtnBkl = ole2_endian_convert_32(pHeader->fcPlcfAtnBkl); -pHeader->lcbPlcfAtnBkl = ole2_endian_convert_32(pHeader->lcbPlcfAtnBkl); -pHeader->fcPms = ole2_endian_convert_32(pHeader->fcPms); -pHeader->lcbPms = ole2_endian_convert_32(pHeader->lcbPms); -pHeader->fcFormFldSttbs = ole2_endian_convert_32(pHeader->fcFormFldSttbs); -pHeader->lcbFormFldSttbs = ole2_endian_convert_32(pHeader->lcbFormFldSttbs); -pHeader->fcPlcfendRef = ole2_endian_convert_32(pHeader->fcPlcfendRef); -pHeader->lcbPlcfendRef = ole2_endian_convert_32(pHeader->lcbPlcfendRef); -pHeader->fcPlcfendTxt = ole2_endian_convert_32(pHeader->fcPlcfendTxt); -pHeader->lcbPlcfendTxt = ole2_endian_convert_32(pHeader->lcbPlcfendTxt); -pHeader->fcPlcfFldEdn = ole2_endian_convert_32(pHeader->fcPlcfFldEdn); -pHeader->lcbPlcfFldEdn = ole2_endian_convert_32(pHeader->lcbPlcfFldEdn); -pHeader->fcUnused4 = ole2_endian_convert_32(pHeader->fcUnused4); -pHeader->lcbUnused4 = ole2_endian_convert_32(pHeader->lcbUnused4); -pHeader->fcDggInfo = ole2_endian_convert_32(pHeader->fcDggInfo); -pHeader->lcbDggInfo = ole2_endian_convert_32(pHeader->lcbDggInfo); -pHeader->fcSttbfRMark = ole2_endian_convert_32(pHeader->fcSttbfRMark); -pHeader->lcbSttbfRMark = ole2_endian_convert_32(pHeader->lcbSttbfRMark); -pHeader->fcSttbfCaption = ole2_endian_convert_32(pHeader->fcSttbfCaption); -pHeader->lcbSttbfCaption = ole2_endian_convert_32(pHeader->lcbSttbfCaption); -pHeader->fcSttbfAutoCaption = ole2_endian_convert_32(pHeader->fcSttbfAutoCaption); -pHeader->lcbSttbfAutoCaption = ole2_endian_convert_32(pHeader->lcbSttbfAutoCaption); -pHeader->fcPlcfWkb = ole2_endian_convert_32(pHeader->fcPlcfWkb); -pHeader->lcbPlcfWkb = ole2_endian_convert_32(pHeader->lcbPlcfWkb); -pHeader->fcPlcfSpl = ole2_endian_convert_32(pHeader->fcPlcfSpl); -pHeader->lcbPlcfSpl = ole2_endian_convert_32(pHeader->lcbPlcfSpl); -pHeader->fcPlcftxbxTxt = ole2_endian_convert_32(pHeader->fcPlcftxbxTxt); -pHeader->lcbPlcftxbxTxt = ole2_endian_convert_32(pHeader->lcbPlcftxbxTxt); -pHeader->fcPlcfFldTxbx = ole2_endian_convert_32(pHeader->fcPlcfFldTxbx); -pHeader->lcbPlcfFldTxbx = ole2_endian_convert_32(pHeader->lcbPlcfFldTxbx); -pHeader->fcPlcfHdrtxbxTxt = ole2_endian_convert_32(pHeader->fcPlcfHdrtxbxTxt); -pHeader->lcbPlcfHdrtxbxTxt = ole2_endian_convert_32(pHeader->lcbPlcfHdrtxbxTxt); -pHeader->fcPlcffldHdrTxbx = ole2_endian_convert_32(pHeader->fcPlcffldHdrTxbx); -pHeader->lcbPlcffldHdrTxbx = ole2_endian_convert_32(pHeader->lcbPlcffldHdrTxbx); -pHeader->fcStwUser = ole2_endian_convert_32(pHeader->fcStwUser); -pHeader->lcbStwUser = ole2_endian_convert_32(pHeader->lcbStwUser); -pHeader->fcSttbTtmbd = ole2_endian_convert_32(pHeader->fcSttbTtmbd); -pHeader->lcbSttbTtmbd = ole2_endian_convert_32(pHeader->lcbSttbTtmbd); -pHeader->fcCookieData = ole2_endian_convert_32(pHeader->fcCookieData); -pHeader->lcbCookieData = ole2_endian_convert_32(pHeader->lcbCookieData); -pHeader->fcPgdMotherOldOld = ole2_endian_convert_32(pHeader->fcPgdMotherOldOld); -pHeader->lcbPgdMotherOldOld = ole2_endian_convert_32(pHeader->lcbPgdMotherOldOld); -pHeader->fcBkdMotherOldOld = ole2_endian_convert_32(pHeader->fcBkdMotherOldOld); -pHeader->lcbBkdMotherOldOld = ole2_endian_convert_32(pHeader->lcbBkdMotherOldOld); -pHeader->fcPgdFtnOldOld = ole2_endian_convert_32(pHeader->fcPgdFtnOldOld); -pHeader->lcbPgdFtnOldOld = ole2_endian_convert_32(pHeader->lcbPgdFtnOldOld); -pHeader->fcBkdFtnOldOld = ole2_endian_convert_32(pHeader->fcBkdFtnOldOld); -pHeader->lcbBkdFtnOldOld = ole2_endian_convert_32(pHeader->lcbBkdFtnOldOld); -pHeader->fcPgdEdnOldOld = ole2_endian_convert_32(pHeader->fcPgdEdnOldOld); -pHeader->lcbPgdEdnOldOld = ole2_endian_convert_32(pHeader->lcbPgdEdnOldOld); -pHeader->fcBkdEdnOldOld = ole2_endian_convert_32(pHeader->fcBkdEdnOldOld); -pHeader->lcbBkdEdnOldOld = ole2_endian_convert_32(pHeader->lcbBkdEdnOldOld); -pHeader->fcSttbfIntlFld = ole2_endian_convert_32(pHeader->fcSttbfIntlFld); -pHeader->lcbSttbfIntlFld = ole2_endian_convert_32(pHeader->lcbSttbfIntlFld); -pHeader->fcRouteSlip = ole2_endian_convert_32(pHeader->fcRouteSlip); -pHeader->lcbRouteSlip = ole2_endian_convert_32(pHeader->lcbRouteSlip); -pHeader->fcSttbSavedBy = ole2_endian_convert_32(pHeader->fcSttbSavedBy); -pHeader->lcbSttbSavedBy = ole2_endian_convert_32(pHeader->lcbSttbSavedBy); -pHeader->fcSttbFnm = ole2_endian_convert_32(pHeader->fcSttbFnm); -pHeader->lcbSttbFnm = ole2_endian_convert_32(pHeader->lcbSttbFnm); -pHeader->fcPlfLst = ole2_endian_convert_32(pHeader->fcPlfLst); -pHeader->lcbPlfLst = ole2_endian_convert_32(pHeader->lcbPlfLst); -pHeader->fcPlfLfo = ole2_endian_convert_32(pHeader->fcPlfLfo); -pHeader->lcbPlfLfo = ole2_endian_convert_32(pHeader->lcbPlfLfo); -pHeader->fcPlcfTxbxBkd = ole2_endian_convert_32(pHeader->fcPlcfTxbxBkd); -pHeader->lcbPlcfTxbxBkd = ole2_endian_convert_32(pHeader->lcbPlcfTxbxBkd); -pHeader->fcPlcfTxbxHdrBkd = ole2_endian_convert_32(pHeader->fcPlcfTxbxHdrBkd); -pHeader->lcbPlcfTxbxHdrBkd = ole2_endian_convert_32(pHeader->lcbPlcfTxbxHdrBkd); -pHeader->fcDocUndoWord9 = ole2_endian_convert_32(pHeader->fcDocUndoWord9); -pHeader->lcbDocUndoWord9 = ole2_endian_convert_32(pHeader->lcbDocUndoWord9); -pHeader->fcRgbUse = ole2_endian_convert_32(pHeader->fcRgbUse); -pHeader->lcbRgbUse = ole2_endian_convert_32(pHeader->lcbRgbUse); -pHeader->fcUsp = ole2_endian_convert_32(pHeader->fcUsp); -pHeader->lcbUsp = ole2_endian_convert_32(pHeader->lcbUsp); -pHeader->fcUskf = ole2_endian_convert_32(pHeader->fcUskf); -pHeader->lcbUskf = ole2_endian_convert_32(pHeader->lcbUskf); -pHeader->fcPlcupcRgbUse = ole2_endian_convert_32(pHeader->fcPlcupcRgbUse); -pHeader->lcbPlcupcRgbUse = ole2_endian_convert_32(pHeader->lcbPlcupcRgbUse); -pHeader->fcPlcupcUsp = ole2_endian_convert_32(pHeader->fcPlcupcUsp); -pHeader->lcbPlcupcUsp = ole2_endian_convert_32(pHeader->lcbPlcupcUsp); -pHeader->fcSttbGlsyStyle = ole2_endian_convert_32(pHeader->fcSttbGlsyStyle); -pHeader->lcbSttbGlsyStyle = ole2_endian_convert_32(pHeader->lcbSttbGlsyStyle); -pHeader->fcPlgosl = ole2_endian_convert_32(pHeader->fcPlgosl); -pHeader->lcbPlgosl = ole2_endian_convert_32(pHeader->lcbPlgosl); -pHeader->fcPlcocx = ole2_endian_convert_32(pHeader->fcPlcocx); -pHeader->lcbPlcocx = ole2_endian_convert_32(pHeader->lcbPlcocx); -pHeader->fcPlcfBteLvc = ole2_endian_convert_32(pHeader->fcPlcfBteLvc); -pHeader->lcbPlcfBteLvc = ole2_endian_convert_32(pHeader->lcbPlcfBteLvc); -pHeader->dwLowDateTime = ole2_endian_convert_32(pHeader->dwLowDateTime); -pHeader->dwHighDateTime = ole2_endian_convert_32(pHeader->dwHighDateTime); -pHeader->fcPlcfLvcPre10 = ole2_endian_convert_32(pHeader->fcPlcfLvcPre10); -pHeader->lcbPlcfLvcPre10 = ole2_endian_convert_32(pHeader->lcbPlcfLvcPre10); -pHeader->fcPlcfAsumy = ole2_endian_convert_32(pHeader->fcPlcfAsumy); -pHeader->lcbPlcfAsumy = ole2_endian_convert_32(pHeader->lcbPlcfAsumy); -pHeader->fcPlcfGram = ole2_endian_convert_32(pHeader->fcPlcfGram); -pHeader->lcbPlcfGram = ole2_endian_convert_32(pHeader->lcbPlcfGram); -pHeader->fcSttbListNames = ole2_endian_convert_32(pHeader->fcSttbListNames); -pHeader->lcbSttbListNames = ole2_endian_convert_32(pHeader->lcbSttbListNames); -pHeader->fcSttbfUssr = ole2_endian_convert_32(pHeader->fcSttbfUssr); -pHeader->lcbSttbfUssr = ole2_endian_convert_32(pHeader->lcbSttbfUssr); + pHeader->fcStshfOrig = ole2_endian_convert_32(pHeader->fcStshfOrig); + pHeader->lcbStshfOrig = ole2_endian_convert_32(pHeader->lcbStshfOrig); + pHeader->fcStshf = ole2_endian_convert_32(pHeader->fcStshf); + pHeader->lcbStshf = ole2_endian_convert_32(pHeader->lcbStshf); + pHeader->fcPlcffndRef = ole2_endian_convert_32(pHeader->fcPlcffndRef); + pHeader->lcbPlcffndRef = ole2_endian_convert_32(pHeader->lcbPlcffndRef); + pHeader->fcPlcffndTxt = ole2_endian_convert_32(pHeader->fcPlcffndTxt); + pHeader->lcbPlcffndTxt = ole2_endian_convert_32(pHeader->lcbPlcffndTxt); + pHeader->fcPlcfandRef = ole2_endian_convert_32(pHeader->fcPlcfandRef); + pHeader->lcbPlcfandRef = ole2_endian_convert_32(pHeader->lcbPlcfandRef); + pHeader->fcPlcfandTxt = ole2_endian_convert_32(pHeader->fcPlcfandTxt); + pHeader->lcbPlcfandTxt = ole2_endian_convert_32(pHeader->lcbPlcfandTxt); + pHeader->fcPlcfSed = ole2_endian_convert_32(pHeader->fcPlcfSed); + pHeader->lcbPlcfSed = ole2_endian_convert_32(pHeader->lcbPlcfSed); + pHeader->fcPlcPad = ole2_endian_convert_32(pHeader->fcPlcPad); + pHeader->lcbPlcPad = ole2_endian_convert_32(pHeader->lcbPlcPad); + pHeader->fcPlcfPhe = ole2_endian_convert_32(pHeader->fcPlcfPhe); + pHeader->lcbPlcfPhe = ole2_endian_convert_32(pHeader->lcbPlcfPhe); + pHeader->fcSttbfGlsy = ole2_endian_convert_32(pHeader->fcSttbfGlsy); + pHeader->lcbSttbfGlsy = ole2_endian_convert_32(pHeader->lcbSttbfGlsy); + pHeader->fcPlcfGlsy = ole2_endian_convert_32(pHeader->fcPlcfGlsy); + pHeader->lcbPlcfGlsy = ole2_endian_convert_32(pHeader->lcbPlcfGlsy); + pHeader->fcPlcfHdd = ole2_endian_convert_32(pHeader->fcPlcfHdd); + pHeader->lcbPlcfHdd = ole2_endian_convert_32(pHeader->lcbPlcfHdd); + pHeader->fcPlcfBteChpx = ole2_endian_convert_32(pHeader->fcPlcfBteChpx); + pHeader->lcbPlcfBteChpx = ole2_endian_convert_32(pHeader->lcbPlcfBteChpx); + pHeader->fcPlcfBtePapx = ole2_endian_convert_32(pHeader->fcPlcfBtePapx); + pHeader->lcbPlcfBtePapx = ole2_endian_convert_32(pHeader->lcbPlcfBtePapx); + pHeader->fcPlcfSea = ole2_endian_convert_32(pHeader->fcPlcfSea); + pHeader->lcbPlcfSea = ole2_endian_convert_32(pHeader->lcbPlcfSea); + pHeader->fcSttbfFfn = ole2_endian_convert_32(pHeader->fcSttbfFfn); + pHeader->lcbSttbfFfn = ole2_endian_convert_32(pHeader->lcbSttbfFfn); + pHeader->fcPlcfFldMom = ole2_endian_convert_32(pHeader->fcPlcfFldMom); + pHeader->lcbPlcfFldMom = ole2_endian_convert_32(pHeader->lcbPlcfFldMom); + pHeader->fcPlcfFldHdr = ole2_endian_convert_32(pHeader->fcPlcfFldHdr); + pHeader->lcbPlcfFldHdr = ole2_endian_convert_32(pHeader->lcbPlcfFldHdr); + pHeader->fcPlcfFldFtn = ole2_endian_convert_32(pHeader->fcPlcfFldFtn); + pHeader->lcbPlcfFldFtn = ole2_endian_convert_32(pHeader->lcbPlcfFldFtn); + pHeader->fcPlcfFldAtn = ole2_endian_convert_32(pHeader->fcPlcfFldAtn); + pHeader->lcbPlcfFldAtn = ole2_endian_convert_32(pHeader->lcbPlcfFldAtn); + pHeader->fcPlcfFldMcr = ole2_endian_convert_32(pHeader->fcPlcfFldMcr); + pHeader->lcbPlcfFldMcr = ole2_endian_convert_32(pHeader->lcbPlcfFldMcr); + pHeader->fcSttbfBkmk = ole2_endian_convert_32(pHeader->fcSttbfBkmk); + pHeader->lcbSttbfBkmk = ole2_endian_convert_32(pHeader->lcbSttbfBkmk); + pHeader->fcPlcfBkf = ole2_endian_convert_32(pHeader->fcPlcfBkf); + pHeader->lcbPlcfBkf = ole2_endian_convert_32(pHeader->lcbPlcfBkf); + pHeader->fcPlcfBkl = ole2_endian_convert_32(pHeader->fcPlcfBkl); + pHeader->lcbPlcfBkl = ole2_endian_convert_32(pHeader->lcbPlcfBkl); + pHeader->fcCmds = ole2_endian_convert_32(pHeader->fcCmds); + pHeader->lcbCmds = ole2_endian_convert_32(pHeader->lcbCmds); + pHeader->fcUnused1 = ole2_endian_convert_32(pHeader->fcUnused1); + pHeader->lcbUnused1 = ole2_endian_convert_32(pHeader->lcbUnused1); + pHeader->fcSttbfMcr = ole2_endian_convert_32(pHeader->fcSttbfMcr); + pHeader->lcbSttbfMcr = ole2_endian_convert_32(pHeader->lcbSttbfMcr); + pHeader->fcPrDrvr = ole2_endian_convert_32(pHeader->fcPrDrvr); + pHeader->lcbPrDrvr = ole2_endian_convert_32(pHeader->lcbPrDrvr); + pHeader->fcPrEnvPort = ole2_endian_convert_32(pHeader->fcPrEnvPort); + pHeader->lcbPrEnvPort = ole2_endian_convert_32(pHeader->lcbPrEnvPort); + pHeader->fcPrEnvLand = ole2_endian_convert_32(pHeader->fcPrEnvLand); + pHeader->lcbPrEnvLand = ole2_endian_convert_32(pHeader->lcbPrEnvLand); + pHeader->fcWss = ole2_endian_convert_32(pHeader->fcWss); + pHeader->lcbWss = ole2_endian_convert_32(pHeader->lcbWss); + pHeader->fcDop = ole2_endian_convert_32(pHeader->fcDop); + pHeader->lcbDop = ole2_endian_convert_32(pHeader->lcbDop); + pHeader->fcSttbfAssoc = ole2_endian_convert_32(pHeader->fcSttbfAssoc); + pHeader->lcbSttbfAssoc = ole2_endian_convert_32(pHeader->lcbSttbfAssoc); + pHeader->fcClx = ole2_endian_convert_32(pHeader->fcClx); + pHeader->lcbClx = ole2_endian_convert_32(pHeader->lcbClx); + pHeader->fcPlcfPgdFtn = ole2_endian_convert_32(pHeader->fcPlcfPgdFtn); + pHeader->lcbPlcfPgdFtn = ole2_endian_convert_32(pHeader->lcbPlcfPgdFtn); + pHeader->fcAutosaveSource = ole2_endian_convert_32(pHeader->fcAutosaveSource); + pHeader->lcbAutosaveSource = ole2_endian_convert_32(pHeader->lcbAutosaveSource); + pHeader->fcGrpXstAtnOwners = ole2_endian_convert_32(pHeader->fcGrpXstAtnOwners); + pHeader->lcbGrpXstAtnOwners = ole2_endian_convert_32(pHeader->lcbGrpXstAtnOwners); + pHeader->fcSttbfAtnBkmk = ole2_endian_convert_32(pHeader->fcSttbfAtnBkmk); + pHeader->lcbSttbfAtnBkmk = ole2_endian_convert_32(pHeader->lcbSttbfAtnBkmk); + pHeader->fcUnused2 = ole2_endian_convert_32(pHeader->fcUnused2); + pHeader->lcbUnused2 = ole2_endian_convert_32(pHeader->lcbUnused2); + pHeader->fcUnused3 = ole2_endian_convert_32(pHeader->fcUnused3); + pHeader->lcbUnused3 = ole2_endian_convert_32(pHeader->lcbUnused3); + pHeader->fcPlcSpaMom = ole2_endian_convert_32(pHeader->fcPlcSpaMom); + pHeader->lcbPlcSpaMom = ole2_endian_convert_32(pHeader->lcbPlcSpaMom); + pHeader->fcPlcSpaHdr = ole2_endian_convert_32(pHeader->fcPlcSpaHdr); + pHeader->lcbPlcSpaHdr = ole2_endian_convert_32(pHeader->lcbPlcSpaHdr); + pHeader->fcPlcfAtnBkf = ole2_endian_convert_32(pHeader->fcPlcfAtnBkf); + pHeader->lcbPlcfAtnBkf = ole2_endian_convert_32(pHeader->lcbPlcfAtnBkf); + pHeader->fcPlcfAtnBkl = ole2_endian_convert_32(pHeader->fcPlcfAtnBkl); + pHeader->lcbPlcfAtnBkl = ole2_endian_convert_32(pHeader->lcbPlcfAtnBkl); + pHeader->fcPms = ole2_endian_convert_32(pHeader->fcPms); + pHeader->lcbPms = ole2_endian_convert_32(pHeader->lcbPms); + pHeader->fcFormFldSttbs = ole2_endian_convert_32(pHeader->fcFormFldSttbs); + pHeader->lcbFormFldSttbs = ole2_endian_convert_32(pHeader->lcbFormFldSttbs); + pHeader->fcPlcfendRef = ole2_endian_convert_32(pHeader->fcPlcfendRef); + pHeader->lcbPlcfendRef = ole2_endian_convert_32(pHeader->lcbPlcfendRef); + pHeader->fcPlcfendTxt = ole2_endian_convert_32(pHeader->fcPlcfendTxt); + pHeader->lcbPlcfendTxt = ole2_endian_convert_32(pHeader->lcbPlcfendTxt); + pHeader->fcPlcfFldEdn = ole2_endian_convert_32(pHeader->fcPlcfFldEdn); + pHeader->lcbPlcfFldEdn = ole2_endian_convert_32(pHeader->lcbPlcfFldEdn); + pHeader->fcUnused4 = ole2_endian_convert_32(pHeader->fcUnused4); + pHeader->lcbUnused4 = ole2_endian_convert_32(pHeader->lcbUnused4); + pHeader->fcDggInfo = ole2_endian_convert_32(pHeader->fcDggInfo); + pHeader->lcbDggInfo = ole2_endian_convert_32(pHeader->lcbDggInfo); + pHeader->fcSttbfRMark = ole2_endian_convert_32(pHeader->fcSttbfRMark); + pHeader->lcbSttbfRMark = ole2_endian_convert_32(pHeader->lcbSttbfRMark); + pHeader->fcSttbfCaption = ole2_endian_convert_32(pHeader->fcSttbfCaption); + pHeader->lcbSttbfCaption = ole2_endian_convert_32(pHeader->lcbSttbfCaption); + pHeader->fcSttbfAutoCaption = ole2_endian_convert_32(pHeader->fcSttbfAutoCaption); + pHeader->lcbSttbfAutoCaption = ole2_endian_convert_32(pHeader->lcbSttbfAutoCaption); + pHeader->fcPlcfWkb = ole2_endian_convert_32(pHeader->fcPlcfWkb); + pHeader->lcbPlcfWkb = ole2_endian_convert_32(pHeader->lcbPlcfWkb); + pHeader->fcPlcfSpl = ole2_endian_convert_32(pHeader->fcPlcfSpl); + pHeader->lcbPlcfSpl = ole2_endian_convert_32(pHeader->lcbPlcfSpl); + pHeader->fcPlcftxbxTxt = ole2_endian_convert_32(pHeader->fcPlcftxbxTxt); + pHeader->lcbPlcftxbxTxt = ole2_endian_convert_32(pHeader->lcbPlcftxbxTxt); + pHeader->fcPlcfFldTxbx = ole2_endian_convert_32(pHeader->fcPlcfFldTxbx); + pHeader->lcbPlcfFldTxbx = ole2_endian_convert_32(pHeader->lcbPlcfFldTxbx); + pHeader->fcPlcfHdrtxbxTxt = ole2_endian_convert_32(pHeader->fcPlcfHdrtxbxTxt); + pHeader->lcbPlcfHdrtxbxTxt = ole2_endian_convert_32(pHeader->lcbPlcfHdrtxbxTxt); + pHeader->fcPlcffldHdrTxbx = ole2_endian_convert_32(pHeader->fcPlcffldHdrTxbx); + pHeader->lcbPlcffldHdrTxbx = ole2_endian_convert_32(pHeader->lcbPlcffldHdrTxbx); + pHeader->fcStwUser = ole2_endian_convert_32(pHeader->fcStwUser); + pHeader->lcbStwUser = ole2_endian_convert_32(pHeader->lcbStwUser); + pHeader->fcSttbTtmbd = ole2_endian_convert_32(pHeader->fcSttbTtmbd); + pHeader->lcbSttbTtmbd = ole2_endian_convert_32(pHeader->lcbSttbTtmbd); + pHeader->fcCookieData = ole2_endian_convert_32(pHeader->fcCookieData); + pHeader->lcbCookieData = ole2_endian_convert_32(pHeader->lcbCookieData); + pHeader->fcPgdMotherOldOld = ole2_endian_convert_32(pHeader->fcPgdMotherOldOld); + pHeader->lcbPgdMotherOldOld = ole2_endian_convert_32(pHeader->lcbPgdMotherOldOld); + pHeader->fcBkdMotherOldOld = ole2_endian_convert_32(pHeader->fcBkdMotherOldOld); + pHeader->lcbBkdMotherOldOld = ole2_endian_convert_32(pHeader->lcbBkdMotherOldOld); + pHeader->fcPgdFtnOldOld = ole2_endian_convert_32(pHeader->fcPgdFtnOldOld); + pHeader->lcbPgdFtnOldOld = ole2_endian_convert_32(pHeader->lcbPgdFtnOldOld); + pHeader->fcBkdFtnOldOld = ole2_endian_convert_32(pHeader->fcBkdFtnOldOld); + pHeader->lcbBkdFtnOldOld = ole2_endian_convert_32(pHeader->lcbBkdFtnOldOld); + pHeader->fcPgdEdnOldOld = ole2_endian_convert_32(pHeader->fcPgdEdnOldOld); + pHeader->lcbPgdEdnOldOld = ole2_endian_convert_32(pHeader->lcbPgdEdnOldOld); + pHeader->fcBkdEdnOldOld = ole2_endian_convert_32(pHeader->fcBkdEdnOldOld); + pHeader->lcbBkdEdnOldOld = ole2_endian_convert_32(pHeader->lcbBkdEdnOldOld); + pHeader->fcSttbfIntlFld = ole2_endian_convert_32(pHeader->fcSttbfIntlFld); + pHeader->lcbSttbfIntlFld = ole2_endian_convert_32(pHeader->lcbSttbfIntlFld); + pHeader->fcRouteSlip = ole2_endian_convert_32(pHeader->fcRouteSlip); + pHeader->lcbRouteSlip = ole2_endian_convert_32(pHeader->lcbRouteSlip); + pHeader->fcSttbSavedBy = ole2_endian_convert_32(pHeader->fcSttbSavedBy); + pHeader->lcbSttbSavedBy = ole2_endian_convert_32(pHeader->lcbSttbSavedBy); + pHeader->fcSttbFnm = ole2_endian_convert_32(pHeader->fcSttbFnm); + pHeader->lcbSttbFnm = ole2_endian_convert_32(pHeader->lcbSttbFnm); + pHeader->fcPlfLst = ole2_endian_convert_32(pHeader->fcPlfLst); + pHeader->lcbPlfLst = ole2_endian_convert_32(pHeader->lcbPlfLst); + pHeader->fcPlfLfo = ole2_endian_convert_32(pHeader->fcPlfLfo); + pHeader->lcbPlfLfo = ole2_endian_convert_32(pHeader->lcbPlfLfo); + pHeader->fcPlcfTxbxBkd = ole2_endian_convert_32(pHeader->fcPlcfTxbxBkd); + pHeader->lcbPlcfTxbxBkd = ole2_endian_convert_32(pHeader->lcbPlcfTxbxBkd); + pHeader->fcPlcfTxbxHdrBkd = ole2_endian_convert_32(pHeader->fcPlcfTxbxHdrBkd); + pHeader->lcbPlcfTxbxHdrBkd = ole2_endian_convert_32(pHeader->lcbPlcfTxbxHdrBkd); + pHeader->fcDocUndoWord9 = ole2_endian_convert_32(pHeader->fcDocUndoWord9); + pHeader->lcbDocUndoWord9 = ole2_endian_convert_32(pHeader->lcbDocUndoWord9); + pHeader->fcRgbUse = ole2_endian_convert_32(pHeader->fcRgbUse); + pHeader->lcbRgbUse = ole2_endian_convert_32(pHeader->lcbRgbUse); + pHeader->fcUsp = ole2_endian_convert_32(pHeader->fcUsp); + pHeader->lcbUsp = ole2_endian_convert_32(pHeader->lcbUsp); + pHeader->fcUskf = ole2_endian_convert_32(pHeader->fcUskf); + pHeader->lcbUskf = ole2_endian_convert_32(pHeader->lcbUskf); + pHeader->fcPlcupcRgbUse = ole2_endian_convert_32(pHeader->fcPlcupcRgbUse); + pHeader->lcbPlcupcRgbUse = ole2_endian_convert_32(pHeader->lcbPlcupcRgbUse); + pHeader->fcPlcupcUsp = ole2_endian_convert_32(pHeader->fcPlcupcUsp); + pHeader->lcbPlcupcUsp = ole2_endian_convert_32(pHeader->lcbPlcupcUsp); + pHeader->fcSttbGlsyStyle = ole2_endian_convert_32(pHeader->fcSttbGlsyStyle); + pHeader->lcbSttbGlsyStyle = ole2_endian_convert_32(pHeader->lcbSttbGlsyStyle); + pHeader->fcPlgosl = ole2_endian_convert_32(pHeader->fcPlgosl); + pHeader->lcbPlgosl = ole2_endian_convert_32(pHeader->lcbPlgosl); + pHeader->fcPlcocx = ole2_endian_convert_32(pHeader->fcPlcocx); + pHeader->lcbPlcocx = ole2_endian_convert_32(pHeader->lcbPlcocx); + pHeader->fcPlcfBteLvc = ole2_endian_convert_32(pHeader->fcPlcfBteLvc); + pHeader->lcbPlcfBteLvc = ole2_endian_convert_32(pHeader->lcbPlcfBteLvc); + pHeader->dwLowDateTime = ole2_endian_convert_32(pHeader->dwLowDateTime); + pHeader->dwHighDateTime = ole2_endian_convert_32(pHeader->dwHighDateTime); + pHeader->fcPlcfLvcPre10 = ole2_endian_convert_32(pHeader->fcPlcfLvcPre10); + pHeader->lcbPlcfLvcPre10 = ole2_endian_convert_32(pHeader->lcbPlcfLvcPre10); + pHeader->fcPlcfAsumy = ole2_endian_convert_32(pHeader->fcPlcfAsumy); + pHeader->lcbPlcfAsumy = ole2_endian_convert_32(pHeader->lcbPlcfAsumy); + pHeader->fcPlcfGram = ole2_endian_convert_32(pHeader->fcPlcfGram); + pHeader->lcbPlcfGram = ole2_endian_convert_32(pHeader->lcbPlcfGram); + pHeader->fcSttbListNames = ole2_endian_convert_32(pHeader->fcSttbListNames); + pHeader->lcbSttbListNames = ole2_endian_convert_32(pHeader->lcbSttbListNames); + pHeader->fcSttbfUssr = ole2_endian_convert_32(pHeader->fcSttbfUssr); + pHeader->lcbSttbfUssr = ole2_endian_convert_32(pHeader->lcbSttbfUssr); } @@ -717,7 +717,7 @@ static void processOfficeArtBlipTIFF(cli_ctx * ctx, OfficeArtRecordHeader * rh, processOfficeArtBlipGeneric(ctx, rh, ptr, 0x6e4, 0x6e5, 1) ; } -static void processOfficeArtBlip(cli_ctx * ctx, const uint8_t * const ptr){ +static size_t processOfficeArtBlip(cli_ctx * ctx, const uint8_t * const ptr){ size_t offset = 0; OfficeArtRecordHeader rh; @@ -727,7 +727,7 @@ static void processOfficeArtBlip(cli_ctx * ctx, const uint8_t * const ptr){ uint8_t recVer = getRecVer(&rh); if (0 != recVer) { cli_dbgmsg("ERROR Invalid recVer 0x%x\n", recVer); - return; + goto done; } #define RECTYPE_OFFICE_ART_BLIP_EMF 0xf01a @@ -767,14 +767,18 @@ static void processOfficeArtBlip(cli_ctx * ctx, const uint8_t * const ptr){ cli_dbgmsg("ERROR Invalid recType 0x%x\n", rh.recType); break; } + +done: + return (sizeof(rh) + rh.recLen); } /* * https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-odraw/2f2d7f5e-d5c4-4cb7-b230-59b3fe8f10d6 */ -static void processOfficeArtFBSE(cli_ctx * ctx, ole2_header_t *hdr, OfficeArtRecordHeader * imageHeader, const uint8_t * const ptr, property_t * wordDocBlock) { +static size_t processOfficeArtFBSE(cli_ctx * ctx, ole2_header_t *hdr, OfficeArtRecordHeader * imageHeader, const uint8_t * const ptr, property_t * wordDocBlock) { OfficeArtFBSEKnown fbse; + // imageCnt = blipStoreRecordHeader.recLen/(sizeof(OfficeArtFBSEKnown) + sizeof(OfficeArtRecordHeader)); uint32_t offset = sizeof(OfficeArtRecordHeader); uint16_t recInst = getRecInst(imageHeader); @@ -783,26 +787,31 @@ static void processOfficeArtFBSE(cli_ctx * ctx, ole2_header_t *hdr, OfficeArtRec if ((recInst != fbse.btWin32) && (recInst != fbse.btMacOS)) { cli_dbgmsg("ERROR Invalid recInst 0x%x\n", recInst); - return; + return offset; } if (imageHeader->recType != 0xf007) { cli_dbgmsg("ERROR Invalid recType 0x%x\n", imageHeader->recType); - return; + return offset; } offset += fbse.cbName; if (imageHeader->recLen == (sizeof(OfficeArtFBSEKnown) + fbse.cbName + fbse.size)) { -fprintf(stderr, "%s::%d::Blip is embedded\n", __FUNCTION__, __LINE__); /* The BLIP is embedded in this record*/ processOfficeArtBlip(ctx, &(ptr[offset])); + offset += fbse.size; } else { /* The BLIP is in the 'WordDocument' stream. */ size_t size = fbse.size; const uint8_t * const ptr = load_pointer_to_stream_from_fmap(hdr, wordDocBlock, fbse.foDelay, size); -fprintf(stderr, "%s::%d::Blip is in WordDocument stream, delay = %u (0x%x)\n", __FUNCTION__, __LINE__, fbse.foDelay, fbse.foDelay); processOfficeArtBlip(ctx, ptr); + + /* I don't *think* I need to add anything to the offset here, because the actual data is not here. + * The data is in a different stream + */ } + return offset; +#if 0 #if 0 size_t i; @@ -818,6 +827,10 @@ fprintf(stderr, "%s::%d::Blip is in WordDocument stream, delay = %u (0x%x)\n", _ #if 1 fprintf(stderr, "%s::%d::before cpy\n", __FUNCTION__, __LINE__); copy_OfficeArtRecordHeader(imageHeader, &(ptr[offset])); + + uint8_t recVer = getRecVer(imageHeader); + fprintf(stderr, "%s::%d::recVer = %d\n", __FUNCTION__, __LINE__, recVer); + offset += sizeof(OfficeArtRecordHeader); copy_OfficeArtFBSEKnown (&fbse, &(ptr[offset])); @@ -845,14 +858,14 @@ fprintf(stderr, "%s::%d::Blip is in WordDocument stream, delay = %u (0x%x)\n", _ offset += fbse.cbName; if (imageHeader->recLen == (sizeof(OfficeArtFBSEKnown) + fbse.cbName + fbse.size)) { -fprintf(stderr, "%s::%d::Blip is embedded\n", __FUNCTION__, __LINE__); + fprintf(stderr, "%s::%d::Blip is embedded\n", __FUNCTION__, __LINE__); /* The BLIP is embedded in this record*/ processOfficeArtBlip(ctx, &(ptr[offset])); } else { /* The BLIP is in the 'WordDocument' stream. */ size_t size = fbse.size; const uint8_t * const ptr = load_pointer_to_stream_from_fmap(hdr, wordDocBlock, fbse.foDelay, size); -fprintf(stderr, "%s::%d::Blip is in WordDocument stream, delay = %u (0x%x)\n", __FUNCTION__, __LINE__, fbse.foDelay, fbse.foDelay); + fprintf(stderr, "%s::%d::Blip is in WordDocument stream, delay = %u (0x%x)\n", __FUNCTION__, __LINE__, fbse.foDelay, fbse.foDelay); processOfficeArtBlip(ctx, ptr); } @@ -892,7 +905,7 @@ fprintf(stderr, "%s::%d::Blip is in WordDocument stream, delay = %u (0x%x)\n", _ fprintf(stderr, "%s::%d::Looks like this might be IT!!!!\n", __FUNCTION__, __LINE__); - +#endif } static void ole2_extract_images(cli_ctx * ctx, ole2_header_t * ole2Hdr, FibRgFcLcb97 * header, const uint8_t * ptr, property_t * wordDocBlock) { @@ -931,9 +944,9 @@ static void ole2_extract_images(cli_ctx * ctx, ole2_header_t * ole2Hdr, FibRgFcL copy_OfficeArtFDGG(&fdgg, &(ptr[offset])); offset += sizeof(OfficeArtFDGG); -/* OfficeArtIDCL is not used in parsing images, only drawings. If details are needed, they are - * https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-odraw/2335d2f8-109b-4cd6-ac8d-40b1237283f3 - * */ + /* OfficeArtIDCL is not used in parsing images, only drawings. If details are needed, they are + * https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-odraw/2335d2f8-109b-4cd6-ac8d-40b1237283f3 + * */ #define OFFICE_ART_IDCL_LEN 8 offset += (OFFICE_ART_IDCL_LEN * (fdgg.cidcl-1)); @@ -955,8 +968,17 @@ static void ole2_extract_images(cli_ctx * ctx, ole2_header_t * ole2Hdr, FibRgFcL return; } + fprintf(stderr, "%s::%d::record len = %d, sizeof = %ld\n", __FUNCTION__, __LINE__, blipStoreRecordHeader.recLen, sizeof(OfficeArtFBSEKnown)); + /* + * imageCnt needs to be determined based on the number of records here, not the 'imageCnt' inside the blipStoreRecordHeader + */ + uint32_t imageCnt = getRecInst (&blipStoreRecordHeader); + // imageCnt = blipStoreRecordHeader.recLen/(sizeof(OfficeArtFBSEKnown) + sizeof(OfficeArtRecordHeader)); + // fprintf(stderr, "%s::%d::IMAGE_CNT = %d\n", __FUNCTION__, __LINE__, imageCnt); + + offset += sizeof(OfficeArtRecordHeader); /*Rec types taken from @@ -967,9 +989,15 @@ static void ole2_extract_images(cli_ctx * ctx, ole2_header_t * ole2Hdr, FibRgFcL * */ #define OFFICE_ART_FBSE_REC_TYPE 0x2 fprintf(stderr, "%s::%d::imageCnt = %d\n", __FUNCTION__, __LINE__, imageCnt); - for (i = 0; i < imageCnt; i++) { + //for (i = 0; i < imageCnt; i++) { + size_t bytesProcessed = 0; + while (bytesProcessed < blipStoreRecordHeader.recLen) + { + size_t off = offset + bytesProcessed; + fprintf(stderr, "%s::%d::bytesProcessed = %ld\n", __FUNCTION__, __LINE__, bytesProcessed); + fprintf(stderr, "%s::%d::blipStoreRecordHeader.recLen= %d\n", __FUNCTION__, __LINE__, blipStoreRecordHeader.recLen); OfficeArtRecordHeader imageHeader; - copy_OfficeArtRecordHeader(&imageHeader, &(ptr[offset])); + copy_OfficeArtRecordHeader(&imageHeader, &(ptr[off])); uint8_t recVer = getRecVer(&imageHeader); if (OFFICE_ART_FBSE_REC_TYPE == recVer){ @@ -977,10 +1005,10 @@ static void ole2_extract_images(cli_ctx * ctx, ole2_header_t * ole2Hdr, FibRgFcL * https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-odraw/2f2d7f5e-d5c4-4cb7-b230-59b3fe8f10d6 */ fprintf(stderr, "%s::%d::calling processOfficeArtFBSE\n", __FUNCTION__, __LINE__); - processOfficeArtFBSE(ctx, ole2Hdr, &imageHeader, &(ptr[offset]), wordDocBlock); + bytesProcessed += processOfficeArtFBSE(ctx, ole2Hdr, &imageHeader, &(ptr[off]), wordDocBlock); } else { fprintf(stderr, "%s::%d::calling processOfficeArtBlip\n", __FUNCTION__, __LINE__); - processOfficeArtBlip(ctx, &(ptr[offset])); + bytesProcessed += processOfficeArtBlip(ctx, &(ptr[off])); } } @@ -1007,37 +1035,37 @@ void ole2_process_image_directory( cli_ctx * ctx, ole2_header_t * hdr, ole2_imag if (directory->bFibRgFcLcb97Header_initialized && (directory->table_stream_0_initialized || directory->table_stream_1_initialized)) { property_t * tableStream = NULL; - /*Get the FIBBase*/ - fib_base_t fib; - uint32_t fib_offset = get_stream_data_offset(hdr, &(directory->word_block), directory->word_block.start_block); - const uint8_t * ptr = NULL; + /*Get the FIBBase*/ + fib_base_t fib; + uint32_t fib_offset = get_stream_data_offset(hdr, &(directory->word_block), directory->word_block.start_block); + const uint8_t * ptr = NULL; - if ((size_t)(hdr->m_length) < (size_t)(fib_offset + sizeof(fib_base_t))) { - cli_dbgmsg("ERROR: Invalid offset for File Information Block %d (0x%x)\n", fib_offset, fib_offset); - goto done; - } + if ((size_t)(hdr->m_length) < (size_t)(fib_offset + sizeof(fib_base_t))) { + cli_dbgmsg("ERROR: Invalid offset for File Information Block %d (0x%x)\n", fib_offset, fib_offset); + goto done; + } - ptr = fmap_need_off_once(hdr->map, fib_offset, sizeof(fib_base_t)); - if (NULL == ptr) { - cli_dbgmsg("ERROR: Invalid offset for File Information Block %d (0x%x)\n", fib_offset, fib_offset); - goto done; - } - copy_fib_base(&fib, ptr); + ptr = fmap_need_off_once(hdr->map, fib_offset, sizeof(fib_base_t)); + if (NULL == ptr) { + cli_dbgmsg("ERROR: Invalid offset for File Information Block %d (0x%x)\n", fib_offset, fib_offset); + goto done; + } + copy_fib_base(&fib, ptr); #define FIB_BASE_fWhichTblStm_OFFSET 9 - if (fib.ABCDEFGHIJKLM & (1 << FIB_BASE_fWhichTblStm_OFFSET)) { - tableStream = &(directory->table_stream_1_block); - if (!directory->table_stream_1_initialized){ - cli_dbgmsg("ERROR: FIB references 1Table stream, that does not exist\n"); - goto done; - } - } else { - tableStream = &(directory->table_stream_0_block); - if (!directory->table_stream_0_initialized){ - cli_dbgmsg("ERROR: FIB references 0Table stream, that does not exist\n"); - goto done; - } + if (fib.ABCDEFGHIJKLM & (1 << FIB_BASE_fWhichTblStm_OFFSET)) { + tableStream = &(directory->table_stream_1_block); + if (!directory->table_stream_1_initialized){ + cli_dbgmsg("ERROR: FIB references 1Table stream, that does not exist\n"); + goto done; } + } else { + tableStream = &(directory->table_stream_0_block); + if (!directory->table_stream_0_initialized){ + cli_dbgmsg("ERROR: FIB references 0Table stream, that does not exist\n"); + goto done; + } + } /*Call Extract */ size_t offset = get_stream_data_offset(hdr, tableStream, tableStream->start_block);