tdf#128208: Don't crash if the zip archive is broken

Change-Id: I71f91752e6adeca1970a21c793cad3b5a5aeba13
This commit is contained in:
Tor Lillqvist
2019-10-18 00:45:46 +03:00
parent f8b8005475
commit d2b36c2674

View File

@@ -86,6 +86,8 @@ static unsigned char readByte(NSFileHandle *file)
if (tmpBuf == nil) if (tmpBuf == nil)
return 0; return 0;
unsigned char *d = (unsigned char*)[tmpBuf bytes]; unsigned char *d = (unsigned char*)[tmpBuf bytes];
if (d == nil)
return 0;
return *d; return *d;
} }
@@ -391,7 +393,7 @@ static NSData *getUncompressedData(NSFileHandle *file, NSString *name)
if (unzipFile == nil) { if (unzipFile == nil) {
//NSLog(@"zip file not open"); //NSLog(@"zip file not open");
return YES; return NO;
} }
//first get the metadata //first get the metadata