diff options
author | Mark Wielaard <mark@klomp.org> | 2013-06-30 17:07:05 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-01 12:24:33 +0000 |
commit | 5c3f673c1ff25c835da6b905a63b36087aaa405e (patch) | |
tree | 33f9dbe2fa5c4eba73d05be1d0013330a088d108 | |
parent | 92ffe57f6bf40ec0f19e2abed24721137c569063 (diff) |
Robustify WW8FormulaControl::FormulaRead reading SvStream.
The >>operator of SvStream doesn't initialize a variable if the stream
is faulty. So initialize the variables before usage to prevent reading
wrong/random bits.
Change-Id: Ia66dd6d8574c36e7229a58347f2e2c1e0fe2e248
Reviewed-on: https://gerrit.libreoffice.org/4636
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 6f2375f95188..e00b6d27ea3b 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2176,7 +2176,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, { sal_uInt8 nField; // nHeaderBype == version - sal_uInt32 nHeaderByte; + sal_uInt32 nHeaderByte = 0; // The following is a FFData structure as described in // Microsoft's DOC specification (chapter 2.9.78) @@ -2185,9 +2185,9 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, // might be better to read the bits as a 16 bit word // ( like it is in the spec. ) - sal_uInt8 bits1; + sal_uInt8 bits1 = 0; *pDataStream >> bits1; - sal_uInt8 bits2; + sal_uInt8 bits2 = 0; *pDataStream >> bits2; sal_uInt8 iType = ( bits1 & 0x3 ); @@ -2199,10 +2199,10 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, sal_uInt8 iRes = (bits1 & 0x7C) >> 2; - sal_uInt16 cch; + sal_uInt16 cch = 0; *pDataStream >> cch; - sal_uInt16 hps; + sal_uInt16 hps = 0; *pDataStream >> hps; // xstzName @@ -2241,9 +2241,9 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, { bool bAllOk = true; // SSTB (see Spec. 2.2.4) - sal_uInt16 fExtend; + sal_uInt16 fExtend = 0; *pDataStream >> fExtend; - sal_uInt16 nNoStrings; + sal_uInt16 nNoStrings = 0; // Isn't it that if fExtend isn't 0xFFFF then fExtend actually // doesn't exist and we really have just read nNoStrings ( or cData )? @@ -2252,7 +2252,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, *pDataStream >> nNoStrings; // I guess this should be zero ( and we should ensure that ) - sal_uInt16 cbExtra; + sal_uInt16 cbExtra = 0; *pDataStream >> cbExtra; OSL_ENSURE(bAllOk, |