[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/source

Eike Rathke (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 17 08:53:10 UTC 2021


 sc/source/ui/docshell/impex.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit c061dc196a30dc14acba5aba5bf538edb3d4fcc4
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Mon Aug 16 21:46:44 2021 +0200
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 17 10:52:36 2021 +0200

    Resolves: tdf#96561 Include embedded null-characters while assembling CSV line
    
    ... instead of prematurely ending analysis and skipping the
    remainder that is still part of data read.
    
    Change-Id: I8f34bc9672e37f9c1c1ae81ddeba464360add7c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120555
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 7bd03074ae7362d8fffe5182529626a0b43a0ed1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120572
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 3f86cc86edb7..7233b14ad640 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2476,8 +2476,17 @@ Label_RetryWithNewSep:
         while (!rStream.eof() && aStr.getLength() < nArbitraryLineLengthLimit)
         {
             const sal_Unicode * p = aStr.getStr() + nLastOffset;
-            while (*p)
+            const sal_Unicode * const pStop = aStr.getStr() + aStr.getLength();
+            while (p < pStop)
             {
+                if (!*p)
+                {
+                    // Skip embedded null-characters. They don't change
+                    // anything and are handled at a higher level.
+                    ++p;
+                    continue;
+                }
+
                 if (nQuotes)
                 {
                     if (*p == cFieldQuote)


More information about the Libreoffice-commits mailing list