Kaydet (Commit) 7b08304b authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#92061 RTF import: fix missing body text after footnote

A missing seek in the \footnote handler could result in a situation that
the missed text contained a "{" but not its matching "}", which resulted
in the parser terminating earlier than the end of the document.

Change-Id: I6df476b2d6397dfa918111b33854dc2f95fbe81d
üst 16c2b60f
{\rtf1
body-before
{\footnote AAAAA {B} C}
body-after\par
}
...@@ -2307,6 +2307,12 @@ DECLARE_RTFIMPORT_TEST(testBinSkipping, "bin-skipping.rtf") ...@@ -2307,6 +2307,12 @@ DECLARE_RTFIMPORT_TEST(testBinSkipping, "bin-skipping.rtf")
CPPUNIT_ASSERT_EQUAL(OUString("text"), getRun(getParagraph(1), 1)->getString()); CPPUNIT_ASSERT_EQUAL(OUString("text"), getRun(getParagraph(1), 1)->getString());
} }
DECLARE_RTFIMPORT_TEST(testTdf92061, "tdf92061.rtf")
{
// This was "C", i.e. part of the footnote ended up in the body text.
CPPUNIT_ASSERT_EQUAL(OUString("body-after"), getRun(getParagraph(1), 3)->getString());
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -1682,11 +1682,13 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) ...@@ -1682,11 +1682,13 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
// Check if this is an endnote. // Check if this is an endnote.
OStringBuffer aBuf; OStringBuffer aBuf;
char ch; char ch;
sal_Size nCurrent = Strm().Tell();
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
Strm().ReadChar(ch); Strm().ReadChar(ch);
aBuf.append(ch); aBuf.append(ch);
} }
Strm().Seek(nCurrent);
OString aKeyword = aBuf.makeStringAndClear(); OString aKeyword = aBuf.makeStringAndClear();
if (aKeyword.equals("\\ftnalt")) if (aKeyword.equals("\\ftnalt"))
nId = NS_ooxml::LN_endnote; nId = NS_ooxml::LN_endnote;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment