Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -31,10 +31,11 @@ #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOpenFileFailedException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" +#import "OFSeekFailedException.h" #import "OFUnsupportedVersionException.h" #import "autorelease.h" #import "macros.h" @@ -219,12 +220,19 @@ uint16_t commentLength; off_t offset = -22; bool valid = false; do { - [_file seekToOffset: offset - whence: SEEK_END]; + @try { + [_file seekToOffset: offset + whence: SEEK_END]; + } @catch (OFSeekFailedException *e) { + if ([e errNo] == EINVAL) + @throw [OFInvalidFormatException exception]; + + @throw e; + } if ([_file readLittleEndianInt32] == 0x06054B50) { valid = true; break; } Index: utils/Makefile ================================================================== --- utils/Makefile +++ utils/Makefile @@ -28,9 +28,9 @@ ${DELETE_FAILED}; \ fi \ fi \ done -CPPFLAGS += -I../src -I../src/runtime -I.. +CPPFLAGS += -I../src -I../src/runtime -I../src/exceptions -I.. LIBS := -L../src -lobjfw ${LIBS} LD = ${OBJC} LDFLAGS += ${LDFLAGS_RPATH}