Blame SOURCES/CVE-2018-7726.part1.patch

5cf55c
From 8f48323c181e20b7e527b8be7229d6eb1148ec5f Mon Sep 17 00:00:00 2001
5cf55c
From: Guido Draheim <guidod@gmx.de>
5cf55c
Date: Tue, 13 Mar 2018 00:23:33 +0100
5cf55c
Subject: [PATCH] check rootseek and rootsize to be positive #27
5cf55c
5cf55c
---
5cf55c
 zzip/zip.c | 4 ++++
5cf55c
 1 file changed, 4 insertions(+)
5cf55c
5cf55c
diff --git a/zzip/zip.c b/zzip/zip.c
5cf55c
index a5db9d8..6be8d7c 100644
5cf55c
--- a/zzip/zip.c
5cf55c
+++ b/zzip/zip.c
5cf55c
@@ -318,6 +318,8 @@ __zzip_fetch_disk_trailer(int fd, zzip_off_t filesize,
5cf55c
                     trailer->zz_rootseek = zzip_disk_trailer_rootseek(orig);
5cf55c
                     trailer->zz_rootsize = zzip_disk_trailer_rootsize(orig);
5cf55c
 #                  endif
5cf55c
+                    if (trailer->zz_rootseek < 0 || trailer->zz_rootsize < 0)
5cf55c
+                       return(ZZIP_CORRUPTED); // forged value
5cf55c
 
5cf55c
                     __fixup_rootseek(offset + tail - mapped, trailer);
5cf55c
 		    /*
5cf55c
@@ -344,6 +346,8 @@ __zzip_fetch_disk_trailer(int fd, zzip_off_t filesize,
5cf55c
                         zzip_disk64_trailer_finalentries(orig);
5cf55c
                     trailer->zz_rootseek = zzip_disk64_trailer_rootseek(orig);
5cf55c
                     trailer->zz_rootsize = zzip_disk64_trailer_rootsize(orig);
5cf55c
+                    if (trailer->zz_rootseek < 0 || trailer->zz_rootsize < 0)
5cf55c
+                       return(ZZIP_CORRUPTED); // forged value
5cf55c
 		    /*
5cf55c
 		     * "extract data from files archived in a single zip file."
5cf55c
 		     * So the file offsets must be within the current ZIP archive!