[fbreader] Handle slightly broken zip files
Only DEFLATED entries can have EXT descriptor, ignore this flag for STORED entries.
This commit is contained in:
parent
36a1bcad0c
commit
ba402d79ff
2 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
|
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
|
||||||
|
* Copyright (C) 2015 Slava Monich <slava.monich@jolla.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -63,7 +64,8 @@ void ZLZipHeader::skipEntry(ZLInputStream &stream, ZLZipHeader &header) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case SignatureLocalFile:
|
case SignatureLocalFile:
|
||||||
if (header.Flags & 0x08) {
|
// Only DEFLATED entries can have EXT descriptor
|
||||||
|
if (header.CompressionMethod != ZLZipHeader::MethodStored && (header.Flags & 0x08)) {
|
||||||
stream.seek(header.ExtraLength, false);
|
stream.seek(header.ExtraLength, false);
|
||||||
ZLZDecompressor decompressor((size_t)-1);
|
ZLZDecompressor decompressor((size_t)-1);
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
|
* Copyright (C) 2004-2010 Geometer Plus <contact@geometerplus.com>
|
||||||
|
* Copyright (C) 2015 Slava Monich <slava.monich@jolla.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -26,6 +27,11 @@ struct ZLZipHeader {
|
||||||
static const unsigned long SignatureLocalFile;
|
static const unsigned long SignatureLocalFile;
|
||||||
static const unsigned long SignatureData;
|
static const unsigned long SignatureData;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MethodStored = 0,
|
||||||
|
MethodDeflated = 8
|
||||||
|
};
|
||||||
|
|
||||||
unsigned long Signature;
|
unsigned long Signature;
|
||||||
unsigned short Version;
|
unsigned short Version;
|
||||||
unsigned short Flags;
|
unsigned short Flags;
|
||||||
|
|
Loading…
Reference in a new issue