From: Xinchen Hui Date: Mon, 10 Apr 2017 03:47:38 +0000 (+0800) Subject: Merge branch 'PHP-7.1' X-Git-Tag: php-7.2.0alpha1~150 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d21404e25174e5f804c897a8e9f289d8e7631b3;p=php Merge branch 'PHP-7.1' * PHP-7.1: Update NEWS Fixed bug #74379 (syntax error compile error in libmagic/apprentice.c) Missed NEWS Conflicts: ext/fileinfo/libmagic.patch --- 2d21404e25174e5f804c897a8e9f289d8e7631b3 diff --cc ext/fileinfo/libmagic.patch index 679a23192b,cdacce7f49..b6c93cab88 --- a/ext/fileinfo/libmagic.patch +++ b/ext/fileinfo/libmagic.patch @@@ -1,6 -1,6 +1,6 @@@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c - --- libmagic.orig/apprentice.c 2016-11-23 17:08:22.955687700 +0100 - +++ libmagic/apprentice.c 2016-11-24 16:55:16.299587400 +0100 ---- libmagic.orig/apprentice.c 2017-04-10 11:41:09.731268025 +0800 -+++ libmagic/apprentice.c 2017-04-10 11:43:17.272811417 +0800 ++--- libmagic.orig/apprentice.c 2017-04-10 11:46:03.857163505 +0800 +++++ libmagic/apprentice.c 2017-04-10 11:46:16.375492995 +0800 @@ -29,6 +29,8 @@ * apprentice - make one pass through /etc/magic, learning its secrets. */ @@@ -49,7 -49,18 +49,18 @@@ #ifndef SSIZE_MAX #define MAXMAGIC_SIZE ((ssize_t)0x7fffffff) - @@ -170,38 +175,7 @@ + @@ -75,6 +80,10 @@ + #endif + #endif + + +#ifndef offsetof + +#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD)) + +#endif + + + #ifndef MAP_FAILED + #define MAP_FAILED (void *) -1 + #endif -@@ -168,38 +177,7 @@ ++@@ -170,38 +179,7 @@ { NULL, 0, NULL } }; @@@ -89,7 -100,7 +100,7 @@@ struct type_tbl_s { const char name[16]; - @@ -285,6 +259,10 @@ -@@ -281,6 +259,10 @@ ++@@ -285,6 +263,10 @@ # undef XX # undef XX_NULL @@@ -100,16 -111,16 +111,16 @@@ private int get_type(const struct type_tbl_s *tbl, const char *l, const char **t) { - @@ -409,7 +387,7 @@ -@@ -405,7 +387,7 @@ ++@@ -409,7 +391,7 @@ struct mlist *ml; - mlp->map = idx == 0 ? map : NULL; + mlp->map = NULL; - if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL) + if ((ml = CAST(struct mlist *, emalloc(sizeof(*ml)))) == NULL) return -1; - ml->map = NULL; -@@ -426,10 +408,8 @@ + ml->map = idx == 0 ? map : NULL; - @@ -430,10 +408,8 @@ ++@@ -430,10 +412,8 @@ apprentice_1(struct magic_set *ms, const char *fn, int action) { struct magic_map *map; @@@ -120,7 -131,7 +131,7 @@@ if (magicsize != FILE_MAGICSIZE) { file_error(ms, 0, "magic element size %lu != %lu", - @@ -449,14 +425,15 @@ -@@ -445,12 +425,13 @@ ++@@ -449,14 +429,15 @@ return apprentice_compile(ms, map, fn); } @@@ -140,7 -149,17 +151,7 @@@ if (map == NULL) return -1; } - @@ -478,9 +455,6 @@ -@@ -458,7 +439,8 @@ - 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; - } - } - -@@ -472,15 +454,6 @@ ++@@ -478,9 +459,6 @@ } } return 0; @@@ -150,7 -175,7 +161,7 @@@ } protected void - @@ -491,10 +465,16 @@ -@@ -491,10 +464,16 @@ ++@@ -491,10 +469,16 @@ return; for (i = 0; i < MAGIC_SETS; i++) mlist_free(ms->mlist[i]); @@@ -171,7 -196,7 +182,7 @@@ } protected struct magic_set * - @@ -503,7 +483,7 @@ -@@ -503,7 +482,7 @@ ++@@ -503,7 +487,7 @@ struct magic_set *ms; size_t i, len; @@@ -180,7 -205,7 +191,7 @@@ sizeof(struct magic_set)))) == NULL) return NULL; - @@ -515,7 +495,7 @@ -@@ -515,7 +494,7 @@ ++@@ -515,7 +499,7 @@ ms->o.buf = ms->o.pbuf = NULL; len = (ms->c.len = 10) * sizeof(*ms->c.li); @@@ -189,8 -214,8 +200,8 @@@ goto free; ms->event_flags = 0; - @@ -533,46 +513,35 @@ -@@ -531,7 +510,7 @@ - ms->elf_notes_max = FILE_ELF_NOTES_MAX; ++@@ -533,46 +517,35 @@ + ms->bytes_max = FILE_BYTES_MAX; return ms; free: - free(ms); @@@ -249,10 -267,10 +260,10 @@@ return NULL; } mlist->next = mlist->prev = mlist; - @@ -591,61 +560,12 @@ -@@ -582,61 +557,12 @@ ++@@ -591,61 +564,12 @@ for (ml = mlist->next; (next = ml->next) != NULL; ml = next) { if (ml->map) - apprentice_unmap(ml->map); + apprentice_unmap(CAST(struct magic_map *, ml->map)); - free(ml); + efree(ml); if (ml == mlist) @@@ -312,7 -330,7 +323,7 @@@ /* const char *fn: list of magic files and directories */ protected int file_apprentice(struct magic_set *ms, const char *fn, int action) - @@ -657,12 +577,28 @@ -@@ -648,12 +574,28 @@ ++@@ -657,12 +581,28 @@ if (ms->mlist[0] != NULL) file_reset(ms); @@@ -342,7 -360,7 +353,7 @@@ file_oomem(ms, strlen(fn)); return -1; } - @@ -675,7 +611,7 @@ -@@ -666,7 +608,7 @@ ++@@ -675,7 +615,7 @@ mlist_free(ms->mlist[i]); ms->mlist[i] = NULL; } @@@ -351,7 -369,7 +362,7 @@@ return -1; } } - @@ -692,7 +628,7 @@ -@@ -683,7 +625,7 @@ ++@@ -692,7 +632,7 @@ fn = p; } @@@ -360,7 -378,7 +371,7 @@@ if (errs == -1) { for (i = 0; i < MAGIC_SETS; i++) { - @@ -1076,7 +1012,7 @@ -@@ -1062,7 +1004,7 @@ ++@@ -1076,7 +1016,7 @@ mset[i].max += ALLOC_INCR; if ((mp = CAST(struct magic_entry *, @@@ -369,7 -387,7 +380,7 @@@ NULL) { file_oomem(ms, sizeof(*mp) * mset[i].max); return -1; - @@ -1097,13 +1033,19 @@ -@@ -1083,13 +1025,19 @@ ++@@ -1097,13 +1037,19 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs, struct magic_entry_set *mset) { @@@ -393,7 -411,7 +404,7 @@@ if (errno != ENOENT) file_error(ms, errno, "cannot read magic file `%s'", fn); - @@ -1113,8 +1055,7 @@ -@@ -1099,8 +1047,7 @@ ++@@ -1113,8 +1059,7 @@ memset(&me, 0, sizeof(me)); /* read and parse this file */ @@@ -403,7 -421,7 +414,7 @@@ if (len == 0) /* null line, garbage, etc */ continue; if (line[len - 1] == '\n') { - @@ -1172,8 +1113,8 @@ -@@ -1158,8 +1105,8 @@ ++@@ -1172,8 +1117,8 @@ } if (me.mp) (void)addentry(ms, &me, mset); @@@ -414,7 -432,7 +425,7 @@@ } /* - @@ -1252,7 +1193,7 @@ -@@ -1238,7 +1185,7 @@ ++@@ -1252,7 +1197,7 @@ mentrycount += me[i].cont_count; slen = sizeof(**ma) * mentrycount; @@@ -423,7 -441,7 +434,7 @@@ file_oomem(ms, slen); return -1; } - @@ -1274,8 +1215,8 @@ -@@ -1260,8 +1207,8 @@ ++@@ -1274,8 +1219,8 @@ if (me == NULL) return; for (i = 0; i < nme; i++) @@@ -434,7 -452,7 +445,7 @@@ } private struct magic_map * - @@ -1284,18 +1225,19 @@ -@@ -1270,18 +1217,19 @@ ++@@ -1284,18 +1229,19 @@ int errs = 0; uint32_t i, j; size_t files = 0, maxfiles = 0; @@@ -459,7 -477,7 +470,7 @@@ { file_oomem(ms, sizeof(*map)); return NULL; - @@ -1307,22 +1249,26 @@ -@@ -1292,22 +1240,26 @@ ++@@ -1307,22 +1253,26 @@ (void)fprintf(stderr, "%s\n", usg_hdr); /* load directory or file */ @@@ -494,7 -512,7 +505,7 @@@ continue; } if (files >= maxfiles) { - @@ -1330,23 +1276,22 @@ -@@ -1315,23 +1267,22 @@ ++@@ -1330,23 +1280,22 @@ maxfiles = (maxfiles + 1) * 2; mlen = maxfiles * sizeof(*filearr); if ((filearr = CAST(char **, @@@ -524,7 -542,7 +535,7 @@@ } else load_1(ms, action, fn, &errs, mset); if (errs) - @@ -1813,7 +1758,7 @@ -@@ -1796,7 +1747,7 @@ ++@@ -1813,7 +1762,7 @@ if (me->cont_count == me->max_count) { struct magic *nm; size_t cnt = me->max_count + ALLOC_CHUNK; @@@ -533,7 -551,7 +544,7 @@@ sizeof(*nm) * cnt))) == NULL) { file_oomem(ms, sizeof(*nm) * cnt); return -1; - @@ -1828,7 +1773,7 @@ -@@ -1811,7 +1762,7 @@ ++@@ -1828,7 +1777,7 @@ static const size_t len = sizeof(*m) * ALLOC_CHUNK; if (me->mp != NULL) return 1; @@@ -542,7 -560,16 +553,7 @@@ file_oomem(ms, len); return -1; } - @@ -2032,7 +1977,7 @@ -@@ -1984,7 +1935,7 @@ - m->type = get_standard_integer_type(l, &l); - else if (*l == 's' && !isalpha((unsigned char)l[1])) { - m->type = FILE_STRING; -- ++l; -+ ++l; - } - } - } -@@ -2005,7 +1956,7 @@ ++@@ -2032,7 +1981,7 @@ m->mask_op = 0; if (*l == '~') { @@@ -551,7 -578,7 +562,7 @@@ m->mask_op |= FILE_OPINVERSE; else if (ms->flags & MAGIC_CHECK) file_magwarn(ms, "'~' invalid for string types"); - @@ -2041,7 +1986,7 @@ -@@ -2014,7 +1965,7 @@ ++@@ -2041,7 +1990,7 @@ m->str_range = 0; m->str_flags = m->type == FILE_PSTRING ? PSTRING_1_LE : 0; if ((op = get_op(*l)) != -1) { @@@ -560,7 -587,7 +571,7 @@@ int r; if (op != FILE_OPDIVIDE) { - @@ -2146,11 +2091,6 @@ -@@ -2119,11 +2070,6 @@ ++@@ -2146,11 +2095,6 @@ if (check_format(ms, m) == -1) return -1; } @@@ -572,7 -599,7 +583,7 @@@ m->mimetype[0] = '\0'; /* initialise MIME type to none */ return 0; } - @@ -2222,7 +2162,7 @@ -@@ -2195,7 +2141,7 @@ ++@@ -2222,7 +2166,7 @@ private int parse_extra(struct magic_set *ms, struct magic_entry *me, const char *line, @@@ -581,7 -608,7 +592,7 @@@ { size_t i; const char *l = line; - @@ -2304,7 +2244,7 @@ -@@ -2264,7 +2210,7 @@ ++@@ -2304,7 +2248,7 @@ struct magic *m = &me->mp[0]; return parse_extra(ms, me, line, @@@ -590,7 -617,7 +601,7 @@@ sizeof(m->mimetype), "MIME", "+-/.", 1); } - @@ -2578,14 +2518,18 @@ -@@ -2517,14 +2463,18 @@ ++@@ -2578,14 +2522,18 @@ return -1; } if (m->type == FILE_REGEX) { @@@ -616,7 -643,7 +627,7 @@@ } return 0; case FILE_FLOAT: - @@ -2924,79 +2868,145 @@ -@@ -2854,68 +2804,144 @@ ++@@ -2924,79 +2872,145 @@ private struct magic_map * apprentice_map(struct magic_set *ms, const char *fn) { @@@ -640,8 -666,8 +651,9 @@@ file_oomem(ms, sizeof(*map)); - goto error; + return NULL; - + } + } - ++- map->type = MAP_TYPE_USER; /* unspecified */ ++ + if (fn == NULL) { + map->p = (void *)&php_magic_database; + goto internal_loaded; @@@ -795,11 -814,10 +806,11 @@@ + if (dbname) { + efree(dbname); + } - return NULL; ++ return NULL; } -@@ -2942,7 +2968,7 @@ + private int - @@ -3022,7 +3032,7 @@ ++@@ -3022,7 +3036,7 @@ version = ptr[1]; if (version != VERSIONNO) { file_error(ms, 0, "File %s supports only version %d magic " @@@ -808,7 -826,7 +819,7 @@@ VERSIONNO, dbname, version); return -1; } - @@ -3063,7 +3073,6 @@ -@@ -2983,7 +3009,6 @@ ++@@ -3063,7 +3077,6 @@ { static const size_t nm = sizeof(*map->nmagic) * MAGIC_SETS; static const size_t m = sizeof(**map->magic); @@@ -816,7 -834,7 +827,7 @@@ size_t len; char *dbname; int rv = -1; - @@ -3072,14 +3081,17 @@ -@@ -2992,14 +3017,18 @@ ++@@ -3072,14 +3085,17 @@ struct magic m; uint32_t h[2 + MAGIC_SETS]; } hdr; @@@ -836,7 -857,7 +847,7 @@@ file_error(ms, errno, "cannot open `%s'", dbname); goto out; } - @@ -3088,25 +3100,25 @@ -@@ -3008,24 +3037,25 @@ ++@@ -3088,25 +3104,25 @@ hdr.h[1] = VERSIONNO; memcpy(hdr.h + 2, map->nmagic, nm); @@@ -868,7 -888,7 +879,7 @@@ return rv; } - @@ -3140,16 +3152,18 @@ -@@ -3059,16 +3089,18 @@ ++@@ -3140,16 +3156,18 @@ q++; /* Compatibility with old code that looked in .mime */ if (ms->flags & MAGIC_MIME) { @@@ -892,8 -912,8 +903,8 @@@ + spprintf(&buf, MAXPATHLEN, "%.*s%s", (int)(q - fn), fn, ext); /* Compatibility with old code that looked in .mime */ - if (strstr(p, ".mime") != NULL) -@@ -3158,7 +3190,7 @@ + if (strstr(fn, ".mime") != NULL) - @@ -3239,7 +3253,7 @@ ++@@ -3239,7 +3257,7 @@ m->offset = swap4((uint32_t)m->offset); m->in_offset = swap4((uint32_t)m->in_offset); m->lineno = swap4((uint32_t)m->lineno); @@@ -903,9 -923,9 +914,9 @@@ m->str_flags = swap4(m->str_flags); } diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c - --- libmagic.orig/ascmagic.c 2016-11-23 17:08:23.422184100 +0100 - +++ libmagic/ascmagic.c 2016-11-24 13:42:04.130245900 +0100 ---- libmagic.orig/ascmagic.c 2017-04-10 11:41:09.737268025 +0800 -+++ libmagic/ascmagic.c 2017-04-10 11:41:14.411268021 +0800 -@@ -139,7 +139,7 @@ ++--- libmagic.orig/ascmagic.c 2017-04-10 11:46:03.872171005 +0800 +++++ libmagic/ascmagic.c 2017-04-10 11:46:07.197493002 +0800 +@@ -133,7 +133,7 @@ /* malloc size is a conservative overestimate; could be improved, or at least realloced after conversion. */ mlen = ulen * 6; @@@ -925,8 -945,17 +936,8 @@@ return rv; } diff -u libmagic.orig/cdf.c libmagic/cdf.c - --- libmagic.orig/cdf.c 2016-11-23 17:08:24.328677300 +0100 - +++ libmagic/cdf.c 2016-11-24 13:42:04.138254700 +0100 ---- libmagic.orig/cdf.c 2017-04-10 11:41:09.731268025 +0800 -+++ libmagic/cdf.c 2017-04-10 11:41:14.411268021 +0800 -@@ -35,7 +35,7 @@ - #include "file.h" - - #ifndef lint --FILE_RCSID("@(#)$File: cdf.c,v 1.75 2015/02/27 21:16:55 christos Exp $") -+FILE_RCSID("@(#)$File: cdf.c,v 1.73 2015/01/11 16:58:25 christos Exp $") - #endif - - #include ++--- libmagic.orig/cdf.c 2017-04-10 11:46:03.857163505 +0800 +++++ libmagic/cdf.c 2017-04-10 11:46:07.197493002 +0800 @@ -43,7 +43,17 @@ #include #endif @@@ -1021,9 -1100,20 +1032,9 @@@ if (argc < 2) { (void)fprintf(stderr, "Usage: %s \n", getprogname()); return -1; -@@ -1491,8 +1496,8 @@ - else - cdf_dump_summary_info(&h, &scn); - #endif -- if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst, -- &dir, "Catalog", &scn) == -1) -+ if (cdf_read_catalog(&info, &h, &sat, &ssat, &sst, &dir, -+ &scn) == -1) - warn("Cannot read catalog"); - #ifdef CDF_DEBUG - else diff -u libmagic.orig/cdf.h libmagic/cdf.h - --- libmagic.orig/cdf.h 2016-11-26 14:20:33.240401300 +0100 - +++ libmagic/cdf.h 2016-11-26 14:20:33.781858400 +0100 ---- libmagic.orig/cdf.h 2017-04-10 11:41:09.737268025 +0800 -+++ libmagic/cdf.h 2017-04-10 11:41:14.412268021 +0800 ++--- libmagic.orig/cdf.h 2017-04-10 11:46:03.871170505 +0800 +++++ libmagic/cdf.h 2017-04-10 11:46:07.198493002 +0800 @@ -35,10 +35,12 @@ #ifndef _H_CDF_ #define _H_CDF_ @@@ -1052,8 -1142,8 +1063,8 @@@ void cdf_swap_header(cdf_header_t *); void cdf_unpack_header(cdf_header_t *, char *); diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c - --- libmagic.orig/cdf_time.c 2016-11-23 17:08:25.086670200 +0100 - +++ libmagic/cdf_time.c 2016-11-24 13:40:19.272464700 +0100 ---- libmagic.orig/cdf_time.c 2017-04-10 11:41:09.737268025 +0800 -+++ libmagic/cdf_time.c 2017-04-10 11:41:14.412268021 +0800 ++--- libmagic.orig/cdf_time.c 2017-04-10 11:46:03.872171005 +0800 +++++ libmagic/cdf_time.c 2017-04-10 11:46:07.198493002 +0800 @@ -96,7 +96,7 @@ } @@@ -1103,17 -1193,22 +1114,17 @@@ static const cdf_timestamp_t tst = 0x01A5E403C2D59C00ULL; static const char *ref = "Sat Apr 23 01:30:00 1977"; diff -u libmagic.orig/compress.c libmagic/compress.c - --- libmagic.orig/compress.c 2016-11-23 17:08:25.345167600 +0100 - +++ libmagic/compress.c 2017-01-05 23:15:53.219543000 +0100 ---- libmagic.orig/compress.c 2017-04-10 11:41:09.732268025 +0800 -+++ libmagic/compress.c 2017-04-10 11:41:14.412268021 +0800 -@@ -32,10 +32,11 @@ - * uncompress(method, old, n, newch) - uncompress old into new, - * using method, return sizeof new - */ -+#include "config.h" - #include "file.h" - - #ifndef lint --FILE_RCSID("@(#)$File: compress.c,v 1.78 2015/01/02 21:29:39 christos Exp $") -+FILE_RCSID("@(#)$File: compress.c,v 1.77 2014/12/12 16:33:01 christos Exp $") ++--- libmagic.orig/compress.c 2017-04-10 11:46:03.864167005 +0800 +++++ libmagic/compress.c 2017-04-10 11:46:07.198493002 +0800 +@@ -45,15 +45,13 @@ #endif - - #include "magic.h" -@@ -51,7 +52,7 @@ + #include + #include +-#include +-#include + #ifdef HAVE_SIGNAL_H + #include + # ifndef HAVE_SIG_T typedef void (*sig_t)(int); # endif /* HAVE_SIG_T */ #endif @@@ -1268,39 -1392,9 +1279,39 @@@ } -#endif +#endif /* if PHP_FILEINFO_UNCOMPRESS */ +diff -u libmagic.orig/der.c libmagic/der.c - --- libmagic.orig/der.c 2016-11-23 17:08:25.601237900 +0100 - +++ libmagic/der.c 2017-01-05 23:25:59.696458300 +0100 ++--- libmagic.orig/der.c 2017-04-10 11:46:03.863166505 +0800 +++++ libmagic/der.c 2017-04-10 11:46:07.198493002 +0800 +@@ -51,7 +51,9 @@ + #include "magic.h" + #include "der.h" + #else ++#ifndef PHP_WIN32 + #include ++#endif + #include + #include + #endif +@@ -201,6 +203,7 @@ + der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len) + { + const uint8_t *d = CAST(const uint8_t *, q); ++ uint32_t i; + switch (tag) { + case DER_TAG_PRINTABLE_STRING: + case DER_TAG_UTF8_STRING: +@@ -211,7 +214,7 @@ + break; + } + +- for (uint32_t i = 0; i < len; i++) { ++ for (i = 0; i < len; i++) { + uint32_t z = i << 1; + if (z < blen - 2) + snprintf(buf + z, blen - z, "%.2x", d[i]); diff -u libmagic.orig/elfclass.h libmagic/elfclass.h - --- libmagic.orig/elfclass.h 2016-11-23 17:08:25.910282200 +0100 - +++ libmagic/elfclass.h 2015-07-18 21:35:36.472082600 +0200 ---- libmagic.orig/elfclass.h 2017-04-10 11:41:09.731268025 +0800 -+++ libmagic/elfclass.h 2017-04-10 11:41:14.412268021 +0800 ++--- libmagic.orig/elfclass.h 2017-04-10 11:46:03.857163505 +0800 +++++ libmagic/elfclass.h 2017-04-10 11:46:07.198493002 +0800 @@ -41,7 +41,7 @@ return toomany(ms, "program headers", phnum); flags |= FLAGS_IS_CORE; @@@ -1329,8 -1423,8 +1340,8 @@@ fsize, elf_getu16(swap, elfhdr.e_machine), (int)elf_getu16(swap, elfhdr.e_shstrndx), diff -u libmagic.orig/file.h libmagic/file.h - --- libmagic.orig/file.h 2016-11-26 14:20:33.428933800 +0100 - +++ libmagic/file.h 2016-11-26 14:20:33.993908600 +0100 ---- libmagic.orig/file.h 2017-04-10 11:41:09.731268025 +0800 -+++ libmagic/file.h 2017-04-10 11:41:14.412268021 +0800 ++--- libmagic.orig/file.h 2017-04-10 11:46:03.857163505 +0800 +++++ libmagic/file.h 2017-04-10 11:46:07.198493002 +0800 @@ -33,11 +33,9 @@ #ifndef __file_h__ #define __file_h__ @@@ -1555,8 -1644,8 +1566,8 @@@ #define __RCSID(a) #endif diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c - --- libmagic.orig/fsmagic.c 2016-11-23 17:08:26.758003500 +0100 - +++ libmagic/fsmagic.c 2016-11-24 13:41:34.212917300 +0100 ---- libmagic.orig/fsmagic.c 2017-04-10 11:41:09.730268025 +0800 -+++ libmagic/fsmagic.c 2017-04-10 11:41:14.413268021 +0800 ++--- libmagic.orig/fsmagic.c 2017-04-10 11:46:03.856163005 +0800 +++++ libmagic/fsmagic.c 2017-04-10 11:46:07.199493002 +0800 @@ -63,27 +63,21 @@ # define minor(dev) ((dev) & 0xff) #endif @@@ -1872,9 -1962,42 +1883,9 @@@ #ifdef S_IFSOCK #ifndef __COHERENT__ case S_IFSOCK: -@@ -381,15 +238,15 @@ - * size for raw disk partitions. (If the block special device - * really has zero length, the fact that it is empty will be - * detected and reported correctly when we read the file.) -- */ -- if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) { -- if (mime) { -- if (handle_mime(ms, mime, "x-empty") == -1) -- return -1; -- } else if (file_printf(ms, "%sempty", COMMA) == -1) -+ */ -+ if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) { -+ if (mime) { -+ if (handle_mime(ms, mime, "x-empty") == -1) - return -1; -+ } else if (file_printf(ms, "%sempty", COMMA) == -1) -+ return -1; - break; -- } -+ } - ret = 0; - break; - -@@ -399,9 +256,5 @@ - /*NOTREACHED*/ - } - -- if (!mime && did && ret == 0) { -- if (file_printf(ms, " ") == -1) -- return -1; -- } - return ret; - } diff -u libmagic.orig/funcs.c libmagic/funcs.c - --- libmagic.orig/funcs.c 2016-11-23 17:08:26.917536700 +0100 - +++ libmagic/funcs.c 2016-11-24 13:42:04.163244800 +0100 ---- libmagic.orig/funcs.c 2017-04-10 11:41:09.732268025 +0800 -+++ libmagic/funcs.c 2017-04-10 11:41:14.413268021 +0800 ++--- libmagic.orig/funcs.c 2017-04-10 11:46:03.864167005 +0800 +++++ libmagic/funcs.c 2017-04-10 11:46:07.199493002 +0800 @@ -31,7 +31,6 @@ #endif /* lint */ @@@ -2235,9 -2366,25 +2246,10 @@@ return rbuf; } -@@ -550,10 +523,11 @@ - if (ptr >= eptr - 3) - break; - *ptr++ = '\\'; -- *ptr++ = ((CAST(unsigned int, *s) >> 6) & 7) + '0'; -- *ptr++ = ((CAST(unsigned int, *s) >> 3) & 7) + '0'; -- *ptr++ = ((CAST(unsigned int, *s) >> 0) & 7) + '0'; -+ *ptr++ = ((*s >> 6) & 7) + '0'; -+ *ptr++ = ((*s >> 3) & 7) + '0'; -+ *ptr++ = ((*s >> 0) & 7) + '0'; - } - *ptr = '\0'; - return buf; - } -+ + Common subdirectories: libmagic.orig/.libs and libmagic/.libs diff -u libmagic.orig/magic.c libmagic/magic.c - --- libmagic.orig/magic.c 2016-11-23 17:08:27.605158000 +0100 - +++ libmagic/magic.c 2016-11-24 13:42:10.074024300 +0100 ---- libmagic.orig/magic.c 2017-04-10 11:41:09.737268025 +0800 -+++ libmagic/magic.c 2017-04-10 11:41:14.413268021 +0800 ++--- libmagic.orig/magic.c 2017-04-10 11:46:03.872171005 +0800 +++++ libmagic/magic.c 2017-04-10 11:46:07.199493002 +0800 @@ -25,11 +25,6 @@ * SUCH DAMAGE. */ @@@ -2739,9 -2773,9 +2751,9 @@@ public const char * magic_error(struct magic_set *ms) diff -u libmagic.orig/magic.h libmagic/magic.h - --- libmagic.orig/magic.h 2016-11-23 17:08:27.691621600 +0100 - +++ libmagic/magic.h 2016-11-24 13:41:34.229416200 +0100 ---- libmagic.orig/magic.h 2017-04-10 11:41:09.731268025 +0800 -+++ libmagic/magic.h 2017-04-10 11:41:14.413268021 +0800 -@@ -88,6 +88,7 @@ ++--- libmagic.orig/magic.h 2017-04-10 11:46:03.857163505 +0800 +++++ libmagic/magic.h 2017-04-10 11:46:07.199493002 +0800 +@@ -93,6 +93,7 @@ const char *magic_getpath(const char *, int); const char *magic_file(magic_t, const char *); @@@ -2757,10 -2791,76 +2769,10 @@@ int magic_list(magic_t, const char *); int magic_errno(magic_t); -diff -u libmagic.orig/patchlevel.h libmagic/patchlevel.h ---- libmagic.orig/patchlevel.h 2017-04-10 11:41:09.731268025 +0800 -+++ libmagic/patchlevel.h 2017-04-10 11:41:14.414268021 +0800 -@@ -1,34 +1,43 @@ - #define FILE_VERSION_MAJOR 5 --#define patchlevel 6 -+#define patchlevel 22 - - /* - * Patchlevel file for Ian Darwin's MAGIC command. -- * $File: patchlevel.h,v 1.76 2011/01/17 16:40:41 christos Exp $ -+ * $File: patchlevel.h,v 1.68 2008/03/22 21:39:43 christos Exp $ - * -- * $Log: patchlevel.h,v $ -- * Revision 1.77 2011/04/15 22:07:27 christos -- * fix the patchlevel. -+ * $Log$ -+ * Revision 1.9 2015/03/06 22:27:12 ab -+ * Update libmagic to 5.2X - * -- * Revision 1.76 2011/01/17 16:40:41 christos -- * welcome to 5_05 -+ * $Log$ -+ * Revision 1.8 2014/02/18 22:27:12 ab -+ * Update libmagic to 5.17 - * -- * Revision 1.75 2010/01/22 21:08:13 christos -- * welcome to 5.04 -+ * $Log$ -+ * Revision 1.7 2013/03/26 22:27:12 ab -+ * Update libmagic to 5.14 - * -- * Revision 1.74 2009/05/06 20:32:48 christos -- * welcome to 5.03 -+ * $Log$ -+ * Revision 1.6 2012/03/26 21:01:37 ab -+ * Update libmagic to 5.11 - * -- * Revision 1.73 2009/05/04 15:15:13 christos -- * 5.02... -+ * Revision 1.5 2012/03/25 13:54:37 ab -+ * Update libmagic to 5.04 - * -- * Revision 1.72 2009/04/30 21:20:15 christos -- * 5.01 we are almost here. -+ * Revision 1.4 2009/05/04 20:52:43 scottmac -+ * Update libmagic to 5.02 - * -- * Revision 1.71 2009/01/21 19:09:42 christos -- * file 5.0 -+ * Revision 1.3 2009/03/15 23:02:35 scottmac -+ * Update fileinfo to libmagic 5.00 and remove dependency on dirent.h on Windows - * -- * Revision 1.70 2008/08/30 10:01:01 christos -- * file 4.26 -+ * Revision 1.2 2008/11/02 16:09:27 scottmac -+ * Update libmagic to 4.26 and add support for v6 of the magic file format. -+ * -+ * Revision 1.1 2008/07/11 14:13:50 derick -+ * - Move lib to libmagic -+ * -+ * Revision 1.1 2008/07/11 14:10:50 derick -+ * - Step one for bundling the libmagic library. Some config.m4 issues left. - * - * Revision 1.69 2008/07/02 15:27:05 christos - * welcome to 4.25 diff -u libmagic.orig/print.c libmagic/print.c - --- libmagic.orig/print.c 2016-11-23 17:08:28.349281600 +0100 - +++ libmagic/print.c 2016-11-24 13:42:04.178244800 +0100 ---- libmagic.orig/print.c 2017-04-10 11:41:09.738268025 +0800 -+++ libmagic/print.c 2017-04-10 11:41:14.414268021 +0800 -@@ -28,13 +28,17 @@ ++--- libmagic.orig/print.c 2017-04-10 11:46:03.872171005 +0800 +++++ libmagic/print.c 2017-04-10 11:46:07.199493002 +0800 +@@ -28,6 +28,8 @@ /* * print.c - debugging printout routines */ @@@ -3023,18 -3131,17 +3035,18 @@@ if (tm == NULL) goto out; diff -u libmagic.orig/readcdf.c libmagic/readcdf.c - --- libmagic.orig/readcdf.c 2016-11-23 17:08:28.502932500 +0100 - +++ libmagic/readcdf.c 2016-11-24 13:42:04.185245900 +0100 ---- libmagic.orig/readcdf.c 2017-04-10 11:41:09.737268025 +0800 -+++ libmagic/readcdf.c 2017-04-10 11:41:14.414268021 +0800 -@@ -26,15 +26,21 @@ - #include "file.h" - - #ifndef lint --FILE_RCSID("@(#)$File: readcdf.c,v 1.51 2015/01/11 16:58:25 christos Exp $") -+FILE_RCSID("@(#)$File: readcdf.c,v 1.50 2015/01/02 21:29:39 christos Exp $") - #endif ++--- libmagic.orig/readcdf.c 2017-04-10 11:46:03.871170505 +0800 +++++ libmagic/readcdf.c 2017-04-10 11:46:07.199493002 +0800 +@@ -1,5 +1,5 @@ + /*- +- * Copyright (c) 2008, 2016 Christos Zoulas ++ * Copyright (c) 2008 Christos Zoulas + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without +@@ -31,7 +31,11 @@ --#include + #include #include +#ifdef PHP_WIN32 +#include "win32/unistd.h" @@@ -3129,13 -3247,31 +3141,13 @@@ if (c != NULL && (ec = strchr(c, '\n')) != NULL) *ec = '\0'; -@@ -362,7 +361,7 @@ - int i; - - if ((i = cdf_read_user_stream(info, h, sat, ssat, sst, -- dir, "Catalog", scn)) == -1) -+ dir, "Catalog", scn)) <= 0) - return i; - #ifdef CDF_DEBUG - cdf_dump_catalog(&h, &scn); diff -u libmagic.orig/softmagic.c libmagic/softmagic.c - --- libmagic.orig/softmagic.c 2016-11-23 17:08:28.915798800 +0100 - +++ libmagic/softmagic.c 2016-11-24 13:42:10.086018300 +0100 ---- libmagic.orig/softmagic.c 2017-04-10 11:41:09.730268025 +0800 -+++ libmagic/softmagic.c 2017-04-10 11:41:14.414268021 +0800 -@@ -36,11 +36,19 @@ - #endif /* lint */ - - #include "magic.h" --#include - #include - #include - #include ++--- libmagic.orig/softmagic.c 2017-04-10 11:46:03.856163005 +0800 +++++ libmagic/softmagic.c 2017-04-10 11:46:07.200493002 +0800 +@@ -43,6 +43,10 @@ #include -+#if defined(HAVE_LOCALE_H) -+#include -+#endif -+ + #include "der.h" + +#ifndef PREG_OFFSET_CAPTURE +# define PREG_OFFSET_CAPTURE (1<<8) +#endif @@@ -3549,8 -3681,8 +3561,8 @@@ } case FILE_INDIRECT: diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c - --- libmagic.orig/strcasestr.c 2016-11-23 17:08:29.069351700 +0100 - +++ libmagic/strcasestr.c 2015-07-18 21:35:36.510103100 +0200 ---- libmagic.orig/strcasestr.c 2017-04-10 11:41:09.737268025 +0800 -+++ libmagic/strcasestr.c 2017-04-10 11:41:14.415268021 +0800 ++--- libmagic.orig/strcasestr.c 2017-04-10 11:46:03.872171005 +0800 +++++ libmagic/strcasestr.c 2017-04-10 11:46:07.200493002 +0800 @@ -39,6 +39,8 @@ #include "file.h"