ofz#4817 Chaos with multiple body tags

Change-Id: I4f2ab3a3be0909176599963c8ca113e3af85c832
Reviewed-on: https://gerrit.libreoffice.org/47159
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2017-12-28 22:28:08 +00:00
parent 4475ffbdae
commit 1f349bb10c
2 changed files with 26 additions and 17 deletions

View File

@@ -298,6 +298,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn,
m_bInFootEndNoteSymbol( false ), m_bInFootEndNoteSymbol( false ),
m_bIgnoreHTMLComments( bNoHTMLComments ), m_bIgnoreHTMLComments( bNoHTMLComments ),
m_bRemoveHidden( false ), m_bRemoveHidden( false ),
m_bBodySeen( false ),
m_pTempViewFrame(nullptr) m_pTempViewFrame(nullptr)
{ {
m_nEventId = nullptr; m_nEventId = nullptr;
@@ -1257,6 +1258,11 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken )
switch( nToken ) switch( nToken )
{ {
case HtmlTokenId::BODY_ON: case HtmlTokenId::BODY_ON:
if (m_bBodySeen)
eState = SvParserState::Error;
else
{
m_bBodySeen = true;
if( !m_aStyleSource.isEmpty() ) if( !m_aStyleSource.isEmpty() )
{ {
m_pCSS1Parser->ParseStyleSheet( m_aStyleSource ); m_pCSS1Parser->ParseStyleSheet( m_aStyleSource );
@@ -1278,6 +1284,7 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken )
m_xDoc->getIDocumentContentOperations().InsertPoolItem( *m_pPam, SwFormatPageDesc( pPageDesc ) ); m_xDoc->getIDocumentContentOperations().InsertPoolItem( *m_pPam, SwFormatPageDesc( pPageDesc ) );
} }
} }
}
break; break;
case HtmlTokenId::LINK: case HtmlTokenId::LINK:

View File

@@ -483,6 +483,8 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
bool m_bIgnoreHTMLComments : 1; bool m_bIgnoreHTMLComments : 1;
bool m_bRemoveHidden : 1; // the filter implementation might set the hidden flag bool m_bRemoveHidden : 1; // the filter implementation might set the hidden flag
bool m_bBodySeen : 1;
/// the names corresponding to the DOCINFO field subtypes INFO[1-4] /// the names corresponding to the DOCINFO field subtypes INFO[1-4]
OUString m_InfoNames[4]; OUString m_InfoNames[4];