diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-02-19 17:38:19 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-02-19 17:38:35 +0200 |
commit | 95e6a0885e65cc57b11719cc0658be9d8b78fba9 (patch) | |
tree | f26085e189212b7ee451b7b7dc22766ba56200b2 | |
parent | a062799bd6902061895e19cace0099fadf696bb4 (diff) |
Guard against unsigned ickyness for files less than 1024 bytes
Change-Id: I360fb8db35b36194c4f7ae08c93126e2a7bda853
-rw-r--r-- | extensions/source/macosx/spotlight/OOoSpotlightImporter.m | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/extensions/source/macosx/spotlight/OOoSpotlightImporter.m b/extensions/source/macosx/spotlight/OOoSpotlightImporter.m index a4cefc0b03e3..3a72d5337051 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) |