From d2b36c2674ab382140cf8aa5a4ea457065152f4c Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 18 Oct 2019 00:45:46 +0300 Subject: [PATCH] tdf#128208: Don't crash if the zip archive is broken Change-Id: I71f91752e6adeca1970a21c793cad3b5a5aeba13 --- extensions/source/macosx/spotlight/OOoSpotlightImporter.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/source/macosx/spotlight/OOoSpotlightImporter.m b/extensions/source/macosx/spotlight/OOoSpotlightImporter.m index 07e19332060a..a144fe259562 100644 --- a/extensions/source/macosx/spotlight/OOoSpotlightImporter.m +++ b/extensions/source/macosx/spotlight/OOoSpotlightImporter.m @@ -86,6 +86,8 @@ static unsigned char readByte(NSFileHandle *file) if (tmpBuf == nil) return 0; unsigned char *d = (unsigned char*)[tmpBuf bytes]; + if (d == nil) + return 0; return *d; } @@ -391,7 +393,7 @@ static NSData *getUncompressedData(NSFileHandle *file, NSString *name) if (unzipFile == nil) { //NSLog(@"zip file not open"); - return YES; + return NO; } //first get the metadata