af9dc8
From 7ba1409a1aee5925180de546057ddd84ff267947 Mon Sep 17 00:00:00 2001
af9dc8
From: Remi Collet <rcollet@redhat.com>
af9dc8
Date: Thu, 14 Aug 2014 17:19:03 -0700
af9dc8
Subject: [PATCH] Fix bug #67716 - Segfault in cdf.c
af9dc8
af9dc8
---
af9dc8
 NEWS                        | 1 +
af9dc8
 ext/fileinfo/libmagic/cdf.c | 2 +-
af9dc8
 2 files changed, 2 insertions(+), 1 deletion(-)
af9dc8
af9dc8
diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c
af9dc8
index 429f3b9..2c0a2d9 100644
af9dc8
--- a/ext/fileinfo/libmagic/cdf.c
af9dc8
+++ b/ext/fileinfo/libmagic/cdf.c
af9dc8
@@ -820,7 +820,7 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
af9dc8
 		q = (const uint8_t *)(const void *)
af9dc8
 		    ((const char *)(const void *)p + ofs
af9dc8
 		    - 2 * sizeof(uint32_t));
af9dc8
-		if (q > e) {
af9dc8
+		if (q < p || q > e) {
af9dc8
 			DPRINTF(("Ran of the end %p > %p\n", q, e));
af9dc8
 			goto out;
af9dc8
 		}
af9dc8
-- 
af9dc8
1.9.2
af9dc8