Guard against unsigned ickyness for files less than 1024 bytes
Change-Id: I360fb8db35b36194c4f7ae08c93126e2a7bda853
This commit is contained in:
@@ -219,8 +219,14 @@ static bool findCentralDirectoryEnd(NSFileHandle *file)
|
|||||||
|
|
||||||
[file seekToFileOffset: (fileLength - 4)];
|
[file seekToFileOffset: (fileLength - 4)];
|
||||||
|
|
||||||
|
unsigned long long limit;
|
||||||
|
if (fileLength > 1024)
|
||||||
|
limit = fileLength - 1024;
|
||||||
|
else
|
||||||
|
limit = 0;
|
||||||
|
|
||||||
unsigned long long offset;
|
unsigned long long offset;
|
||||||
while ((offset = [file offsetInFile]) > 0 && offset >= fileLength - 1024)
|
while ((offset = [file offsetInFile]) > limit)
|
||||||
{
|
{
|
||||||
unsigned signature = readInt(file);
|
unsigned signature = readInt(file);
|
||||||
if (signature == CDIR_END_SIG)
|
if (signature == CDIR_END_SIG)
|
||||||
|
Reference in New Issue
Block a user