1 |
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx |
2 |
index 5720af2..7807371 100644 |
3 |
--- a/sw/source/filter/ww8/ww8graf.cxx |
4 |
+++ b/sw/source/filter/ww8/ww8graf.cxx |
5 |
@@ -1052,7 +1052,7 @@ |
6 |
Read_PicLoc(nAktId, pParams, 1); |
7 |
break; |
8 |
} |
9 |
- aSprmIter++; |
10 |
+ aSprmIter.advance(); |
11 |
} |
12 |
|
13 |
//if( bRead_Obj || bRead_PicLoc ) break; |
14 |
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx |
15 |
index 5b66561..65172b1 100644 |
16 |
--- a/sw/source/filter/ww8/ww8par2.cxx |
17 |
+++ b/sw/source/filter/ww8/ww8par2.cxx |
18 |
@@ -1964,7 +1964,7 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) : |
19 |
default: |
20 |
; |
21 |
} |
22 |
- aSprmIter++; |
23 |
+ aSprmIter.advance(); |
24 |
} |
25 |
|
26 |
if( !nLoop ) |
27 |
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx |
28 |
index f2c8fd6..44f1f69 100644 |
29 |
--- a/sw/source/filter/ww8/ww8scan.cxx |
30 |
+++ b/sw/source/filter/ww8/ww8scan.cxx |
31 |
@@ -895,22 +895,17 @@ void WW8SprmIter::SetSprms(const BYTE* pSprms_, long nLen_) |
32 |
UpdateMyMembers(); |
33 |
} |
34 |
|
35 |
-const BYTE* WW8SprmIter::operator ++( int ) |
36 |
+void WW8SprmIter::advance() |
37 |
{ |
38 |
if (nRemLen > 0 ) |
39 |
{ |
40 |
- if( nRemLen >= nAktSize ) |
41 |
- { |
42 |
- pSprms += nAktSize; |
43 |
- nRemLen -= nAktSize; |
44 |
- UpdateMyMembers(); |
45 |
- } |
46 |
- else |
47 |
- { |
48 |
- throw( ::std::exception() ); |
49 |
- } |
50 |
+ USHORT nSize = nAktSize; |
51 |
+ if (nSize > nRemLen) |
52 |
+ nSize = nRemLen; |
53 |
+ pSprms += nSize; |
54 |
+ nRemLen -= nSize; |
55 |
+ UpdateMyMembers(); |
56 |
} |
57 |
- return pSprms; |
58 |
} |
59 |
|
60 |
void WW8SprmIter::UpdateMyMembers() |
61 |
@@ -936,7 +931,7 @@ const BYTE* WW8SprmIter::FindSprm(USHORT nId) |
62 |
{ |
63 |
if( GetAktId() == nId ) |
64 |
return GetAktParams(); // SPRM found! |
65 |
- operator ++(0); |
66 |
+ advance(); |
67 |
} |
68 |
|
69 |
return 0; // SPRM _not_ found |
70 |
@@ -2828,7 +2823,7 @@ bool WW8PLCFx_Fc_FKP::WW8Fkp::HasSprm(USHORT nId, |
71 |
{ |
72 |
if (aIter.GetAktId() == nId) |
73 |
rResult.push_back(aIter.GetAktParams()); |
74 |
- aIter++; |
75 |
+ aIter.advance(); |
76 |
}; |
77 |
return !rResult.empty(); |
78 |
} |
79 |
@@ -3151,7 +3146,7 @@ bool WW8PLCFx_Fc_FKP::HasSprm(USHORT nId, std::vector<const BYTE *> &rResult) |
80 |
{ |
81 |
if (aIter.GetAktId() == nId) |
82 |
rResult.push_back(aIter.GetAktParams()); |
83 |
- aIter++; |
84 |
+ aIter.advance(); |
85 |
}; |
86 |
} |
87 |
return !rResult.empty(); |
88 |
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx |
89 |
index cf6541f..af19986 100644 |
90 |
--- a/sw/source/filter/ww8/ww8scan.hxx |
91 |
+++ b/sw/source/filter/ww8/ww8scan.hxx |
92 |
@@ -261,7 +261,7 @@ public: |
93 |
const wwSprmParser &rSprmParser); |
94 |
void SetSprms( const BYTE* pSprms_, long nLen_ ); |
95 |
const BYTE* FindSprm(USHORT nId); |
96 |
- const BYTE* operator ++( int ); |
97 |
+ void advance(); |
98 |
const BYTE* GetSprms() const |
99 |
{ return ( pSprms && (0 < nRemLen) ) ? pSprms : 0; } |
100 |
const BYTE* GetAktParams() const { return pAktParams; } |
101 |
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx |
102 |
index 801cc2f..0df3331 100644 |
103 |
--- a/sw/source/filter/ww8/ww8par.cxx |
104 |
+++ b/sw/source/filter/ww8/ww8par.cxx |
105 |
@@ -3895,7 +3895,7 @@ void SwWW8ImplReader::ReadDocInfo() |
106 |
xDocProps->setTemplateURL( sTemplateURL ); |
107 |
} |
108 |
} |
109 |
- else // not a template |
110 |
+ else if (pWwFib->lcbSttbfAssoc) // not a template, and has a SttbfAssoc |
111 |
{ |
112 |
long nCur = pTableStream->Tell(); |
113 |
Sttb aSttb; |
114 |
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx |
115 |
index 44f1f69..b1e0351 100644 |
116 |
--- a/sw/source/filter/ww8/ww8scan.cxx |
117 |
+++ b/sw/source/filter/ww8/ww8scan.cxx |
118 |
@@ -2561,6 +2561,7 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt, |
119 |
long nOldPos = pSt->Tell(); |
120 |
|
121 |
pSt->Seek(nFilePos); |
122 |
+ memset(maRawData, 0, 512); |
123 |
pSt->Read(maRawData, 512); |
124 |
mnIMax = maRawData[511]; |
125 |
|
126 |
@@ -2605,24 +2606,36 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt, |
127 |
aEntry.mnLen = maRawData[nOfs+1]; |
128 |
nDelta++; |
129 |
} |
130 |
- |
131 |
aEntry.mnLen *= 2; |
132 |
|
133 |
//stylecode, std/istd |
134 |
if (eVersion == ww::eWW2) |
135 |
{ |
136 |
- aEntry.mnIStd = *(maRawData+nOfs+1+nDelta); |
137 |
- aEntry.mnLen--; //style code |
138 |
- aEntry.mnLen-=6; //PHE |
139 |
- //skipi stc, len byte + 6 byte PHE |
140 |
- aEntry.mpData = maRawData + nOfs + 8; |
141 |
+ if (aEntry.mnLen >= 1) |
142 |
+ { |
143 |
+ aEntry.mnIStd = *(maRawData+nOfs+1+nDelta); |
144 |
+ aEntry.mnLen--; //style code |
145 |
+ if (aEntry.mnLen >= 6) |
146 |
+ { |
147 |
+ aEntry.mnLen-=6; //PHE |
148 |
+ //skipi stc, len byte + 6 byte PHE |
149 |
+ aEntry.mpData = maRawData + nOfs + 8; |
150 |
+ } |
151 |
+ else |
152 |
+ aEntry.mnLen=0; //Too short |
153 |
+ } |
154 |
} |
155 |
else |
156 |
{ |
157 |
- aEntry.mnIStd = SVBT16ToShort(maRawData+nOfs+1+nDelta); |
158 |
- aEntry.mnLen-=2; //istd |
159 |
- //skip istd, len byte + optional extra len byte |
160 |
- aEntry.mpData = maRawData + nOfs + 3 + nDelta; |
161 |
+ if (aEntry.mnLen >= 2) |
162 |
+ { |
163 |
+ aEntry.mnIStd = SVBT16ToShort(maRawData+nOfs+1+nDelta); |
164 |
+ aEntry.mnLen-=2; //istd |
165 |
+ //skip istd, len byte + optional extra len byte |
166 |
+ aEntry.mpData = maRawData + nOfs + 3 + nDelta; |
167 |
+ } |
168 |
+ else |
169 |
+ aEntry.mnLen=0; //Too short, ignore |
170 |
} |
171 |
|
172 |
USHORT nSpId = aEntry.mnLen ? maSprmParser.GetSprmId(aEntry.mpData) : 0; |
173 |
@@ -2666,6 +2679,17 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt, |
174 |
} |
175 |
|
176 |
maEntries.push_back(aEntry); |
177 |
+ |
178 |
+#ifdef DEBUGSPRMREADER |
179 |
+ { |
180 |
+ sal_Int32 nLen; |
181 |
+ BYTE* pSprms = GetLenAndIStdAndSprms( nLen ); |
182 |
+ |
183 |
+ WW8SprmIter aIter(pSprms, nLen, maSprmParser); |
184 |
+ while(aIter.GetSprms()) |
185 |
+ aIter.advance(); |
186 |
+ } |
187 |
+#endif |
188 |
} |
189 |
|
190 |
//one more FC than grrpl entries |
191 |
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx |
192 |
index 81b73e5..daee39b 100644 |
193 |
--- a/filter/source/msfilter/mstoolbar.cxx |
194 |
+++ b/filter/source/msfilter/mstoolbar.cxx |
195 |
@@ -188,10 +188,11 @@ TBBase::indent_printf( FILE* fp, const char* format, ... ) |
196 |
|
197 |
rtl::OUString TBBase::readUnicodeString( SvStream* pS, sal_Int32 nChars ) |
198 |
{ |
199 |
- sal_Int32 nBufSize = nChars * 2; |
200 |
+ sal_Size nBufSize = nChars * 2; |
201 |
boost::scoped_array< sal_uInt8 > pArray( new sal_uInt8[ nBufSize ] ); |
202 |
- pS->Read( pArray.get(), nBufSize ); |
203 |
- return svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pArray.get() ), nBufSize ); |
204 |
+ sal_Size nReadSize = pS->Read( pArray.get(), nBufSize ); |
205 |
+ OSL_ASSERT(nReadSize == nBufSize); |
206 |
+ return svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pArray.get() ), nReadSize ); |
207 |
} |
208 |
|
209 |
TBCHeader::TBCHeader() : bSignature( 0x3 ) |