com php-src: catching up: ext/fileinfo/libmagic/apprentice.c ext/fileinfo/libmagic/softmagic.c
| From: | Anatol Belski | Date: | Sun, 08 Mar 2015 18:47:59 +0000 |
| Subject: | com php-src: catching up: ext/fileinfo/libmagic/apprentice.c ext/fileinfo/libmagic/softmagic.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85334@lists.php.net to get a copy of this message | ||
Commit: 3e8a5485e200ac8da8060d879aa96bb3d18a736a
Author: Anatol Belski <ab@php.net> Fri, 6 Mar 2015 15:16:08 +0100
Parents: eeb74b0ab81f580620954b1d34a350aa105d1dd8
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3e8a5485e200ac8da8060d879aa96bb3d18a736a
Log:
catching up
Changed paths:
M ext/fileinfo/libmagic/apprentice.c
M ext/fileinfo/libmagic/softmagic.c
Diff:
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index 382dd8d..ba9a1a7 100644
--- a/ext/fileinfo/libmagic/apprentice.c
+++ b/ext/fileinfo/libmagic/apprentice.c
@@ -58,9 +58,6 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.230 2015/01/02 21:29:39 christos Exp
$")
#else
#include <unistd.h>
#endif
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif
#include <string.h>
#include <assert.h>
#include <ctype.h>
@@ -441,7 +438,8 @@ apprentice_1(struct magic_set *ms, const char *fn, int action)
for (i = 0; i < MAGIC_SETS; i++) {
if (add_mlist(ms->mlist[i], map, i) == -1) {
file_oomem(ms, sizeof(*ml));
- goto fail;
+ apprentice_unmap(map);
+ return -1;
}
}
@@ -455,12 +453,6 @@ apprentice_1(struct magic_set *ms, const char *fn, int action)
}
}
return 0;
-fail:
- for (i = 0; i < MAGIC_SETS; i++) {
- mlist_free(ms->mlist[i]);
- ms->mlist[i] = NULL;
- }
- return -1;
}
protected void
diff --git a/ext/fileinfo/libmagic/softmagic.c b/ext/fileinfo/libmagic/softmagic.c
index 3ff6f57..9ac177c 100644
--- a/ext/fileinfo/libmagic/softmagic.c
+++ b/ext/fileinfo/libmagic/softmagic.c
@@ -1089,8 +1089,13 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
return 0;
}
- linecnt = m->str_range;
- bytecnt = linecnt * 80;
+ if (m->str_flags & REGEX_LINE_COUNT) {
+ linecnt = m->str_range;
+ bytecnt = linecnt * 80;
+ } else {
+ linecnt = 0;
+ bytecnt = m->str_range;
+ }
/* XXX bytecnt_max is to be kept for PHP, see cve-2014-3538.
PCRE might stuck if the input buffer is too big. To ensure
@@ -1901,7 +1906,6 @@ magiccheck(struct magic_set *ms, struct magic *m)
break;
default:
- matched = 0;
file_magerror(ms, "cannot happen with float: invalid relation `%c'",
m->reln);
return -1;
@@ -1935,7 +1939,6 @@ magiccheck(struct magic_set *ms, struct magic *m)
break;
default:
- matched = 0;
file_magerror(ms, "cannot happen with double: invalid relation `%c'",
m->reln);
return -1;
}
@@ -2184,7 +2187,6 @@ magiccheck(struct magic_set *ms, struct magic *m)
break;
default:
- matched = 0;
file_magerror(ms, "cannot happen: invalid relation `%c'",
m->reln);
return -1;