Kaydet (Commit) 95e6a088 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Guard against unsigned ickyness for files less than 1024 bytes

Change-Id: I360fb8db35b36194c4f7ae08c93126e2a7bda853
üst a062799b
...@@ -219,8 +219,14 @@ static bool findCentralDirectoryEnd(NSFileHandle *file) ...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment