File php-CVE-2015-4604,4605.patch of Package php5.openSUSE_13.2_Update

From: Stanislav Malyshev <stas@php.net>
Date: Sat, 4 Apr 2015 22:01:37 +0000 (-0700)
Subject: Fix bug #68819 (Fileinfo on specific file causes spurious OOM and/or segfault)
X-Git-Tag: php-5.4.40~4^2~13
X-Git-Url: http://72.52.91.13:8000/?p=php-src.git;a=commitdiff_plain;h=f938112c495b0d26572435c0be73ac0bfe642ecd

Fix bug #68819 (Fileinfo on specific file causes spurious OOM and/or segfault)
---

--- ext/fileinfo/libmagic/softmagic.c
+++ ext/fileinfo/libmagic/softmagic.c
@@ -1037,6 +1037,9 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
 			if (bytecnt > nbytes) {
 				bytecnt = nbytes;
 			}
+			if (offset > bytecnt) {
+				offset = bytecnt;
+			}
 			if (s == NULL) {
 				ms->search.s_len = 0;
 				ms->search.s = NULL;
openSUSE Build Service is sponsored by