[Libreoffice-commits] core.git: extensions/source

Tor Lillqvist tml at iki.fi
Tue Feb 19 07:39:07 PST 2013


 extensions/source/macosx/spotlight/OOoSpotlightImporter.m |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 95e6a0885e65cc57b11719cc0658be9d8b78fba9
Author: Tor Lillqvist <tml at iki.fi>
Date:   Tue Feb 19 17:38:19 2013 +0200

    Guard against unsigned ickyness for files less than 1024 bytes
    
    Change-Id: I360fb8db35b36194c4f7ae08c93126e2a7bda853

diff --git a/extensions/source/macosx/spotlight/OOoSpotlightImporter.m b/extensions/source/macosx/spotlight/OOoSpotlightImporter.m
index a4cefc0..3a72d53 100644
--- a/extensions/source/macosx/spotlight/OOoSpotlightImporter.m
+++ b/extensions/source/macosx/spotlight/OOoSpotlightImporter.m
@@ -219,8 +219,14 @@ static bool findCentralDirectoryEnd(NSFileHandle *file)
 
     [file seekToFileOffset: (fileLength - 4)];
 
+    unsigned long long limit;
+    if (fileLength > 1024)
+        limit = fileLength - 1024;
+    else
+        limit = 0;
+
     unsigned long long offset;
-    while ((offset = [file offsetInFile]) > 0 && offset >= fileLength - 1024)
+    while ((offset = [file offsetInFile]) > limit)
     {
         unsigned signature = readInt(file);
         if (signature == CDIR_END_SIG)


More information about the Libreoffice-commits mailing list