[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sw/qa writerfilter/source

Urmas davian818 at gmail.com
Mon May 27 04:59:38 PDT 2013


 sw/qa/extras/rtfimport/data/fdo64671.rtf       |    3 +++
 sw/qa/extras/rtfimport/rtfimport.cxx           |    8 ++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 6226fcc4166f2a8e3c7f2016d423372e9e4a3d0b
Author: Urmas <davian818 at gmail.com>
Date:   Mon May 27 09:49:55 2013 +0200

    fdo#64671 Some special RTF characters were not skipped correctly
    
    Some special characters, like { and }, were not skipped when they
    occured as a replacement character for \uN keyword.
    
    (cherry picked from commits bfb93ffc6d72d22a833acf9d8c9d166153dad7c0 and
    ec8e012e980c88c8f24a7de44e44d0319bae2801)
    
    Conflicts:
    	sw/qa/extras/rtfimport/rtfimport.cxx
    
    Signed-off-by: Miklos Vajna <vmiklos at suse.cz>
    Change-Id: I19b66a290cd9880924774fa89bb29df280e44a3c

diff --git a/sw/qa/extras/rtfimport/data/fdo64671.rtf b/sw/qa/extras/rtfimport/data/fdo64671.rtf
new file mode 100644
index 0000000..385dca4
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo64671.rtf
@@ -0,0 +1,3 @@
+{\rtf1
+\u381\'7d
+\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index bbac478..2e99c27 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -148,6 +148,7 @@ public:
     void testFdo61193();
     void testFdo63023();
     void testFdo62977();
+    void testFdo64671();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -266,6 +267,7 @@ void Test::run()
         {"hello.rtf", &Test::testFdo61193},
         {"fdo63023.rtf", &Test::testFdo63023},
         {"fdo62977.rtf", &Test::testFdo62977},
+        {"fdo64671.rtf", &Test::testFdo64671},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1222,6 +1224,12 @@ void Test::testFdo62977()
     getRun(getParagraph(1), 1, OUString("\xE5\xB9\xB4\xEF\xBC\x94\xE6\x9C\x88", 9, RTL_TEXTENCODING_UTF8));
 }
 
+void Test::testFdo64671()
+{
+    // Additional '}' was inserted before the special character.
+    getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 056ac08..e06bace 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -879,7 +879,7 @@ int RTFDocumentImpl::resolveChars(char ch)
 
     bool bUnicodeChecked = false;
     bool bSkipped = false;
-    while(!Strm().IsEof() && ch != '{' && ch != '}' && ch != '\\')
+    while(!Strm().IsEof() && (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != '{' && ch != '}' && ch != '\\')))
     {
         if (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != 0x0d && ch != 0x0a))
         {


More information about the Libreoffice-commits mailing list