File libzip-segfault-invalid-zip.patch of Package libzip

Index: lib/zip_open.c
===================================================================
--- lib/zip_open.c.orig	2016-01-22 10:04:31.181410345 +0100
+++ lib/zip_open.c	2016-01-22 10:04:31.201410345 +0100
@@ -498,6 +498,11 @@
     zip_int64_t best;
     struct zip_error zerr;
 
+    if (len < (off_t)EOCDLEN) {
+        set_error(zep, NULL, ZIP_ER_NOZIP);
+        return NULL;
+    }
+    
     i = fseeko(fp, -(len < CDBUFSIZE ? len : CDBUFSIZE), SEEK_END);
     if (i == -1 && errno != EFBIG) {
 	/* seek before start of file on my machine */
openSUSE Build Service is sponsored by