Date: Tue, 8 Jul 2014 04:51:43 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r268382 - in user/cperciva/freebsd-update-build/patches: 10.0-RELEASE 9.1-RELEASE 9.2-RELEASE Message-ID: <201407080451.s684ph1P024531@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Tue Jul 8 04:51:42 2014 New Revision: 268382 URL: http://svnweb.freebsd.org/changeset/base/268382 Log: Add patches from previous batch. Added: user/cperciva/freebsd-update-build/patches/10.0-RELEASE/6-EN-14:07.pmap user/cperciva/freebsd-update-build/patches/10.0-RELEASE/6-SA-14:15.iconv user/cperciva/freebsd-update-build/patches/10.0-RELEASE/6-SA-14:16.file user/cperciva/freebsd-update-build/patches/9.1-RELEASE/16-EN-14:08.heimdal user/cperciva/freebsd-update-build/patches/9.1-RELEASE/16-SA-14:16.file user/cperciva/freebsd-update-build/patches/9.2-RELEASE/9-EN-14:08.heimdal user/cperciva/freebsd-update-build/patches/9.2-RELEASE/9-SA-14:16.file Added: user/cperciva/freebsd-update-build/patches/10.0-RELEASE/6-EN-14:07.pmap ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/patches/10.0-RELEASE/6-EN-14:07.pmap Tue Jul 8 04:51:42 2014 (r268382) @@ -0,0 +1,13 @@ +Index: sys/amd64/amd64/pmap.c +=================================================================== +--- sys/amd64/amd64/pmap.c (revision 267572) ++++ sys/amd64/amd64/pmap.c (working copy) +@@ -367,7 +367,7 @@ static int pmap_flags = PMAP_PDE_SUPERPAGE; /* fla + + static struct unrhdr pcid_unr; + static struct mtx pcid_mtx; +-int pmap_pcid_enabled = 1; ++int pmap_pcid_enabled = 0; + SYSCTL_INT(_vm_pmap, OID_AUTO, pcid_enabled, CTLFLAG_RDTUN, &pmap_pcid_enabled, + 0, "Is TLB Context ID enabled ?"); + int invpcid_works = 0; Added: user/cperciva/freebsd-update-build/patches/10.0-RELEASE/6-SA-14:15.iconv ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/patches/10.0-RELEASE/6-SA-14:15.iconv Tue Jul 8 04:51:42 2014 (r268382) @@ -0,0 +1,175 @@ +Index: lib/libc/iconv/citrus_prop.c +=================================================================== +--- lib/libc/iconv/citrus_prop.c (revision 267591) ++++ lib/libc/iconv/citrus_prop.c (working copy) +@@ -339,7 +339,7 @@ name_found: + + static int + _citrus_prop_parse_element(struct _memstream * __restrict ms, +- const _citrus_prop_hint_t * __restrict hints, void ** __restrict context) ++ const _citrus_prop_hint_t * __restrict hints, void * __restrict context) + { + int ch, errnum; + #define _CITRUS_PROP_HINT_NAME_LEN_MAX 255 +@@ -435,8 +435,7 @@ _citrus_prop_parse_variable(const _citrus_prop_hin + if (ch == EOF || ch == '\0') + break; + _memstream_ungetc(&ms, ch); +- errnum = _citrus_prop_parse_element( +- &ms, hints, (void ** __restrict)context); ++ errnum = _citrus_prop_parse_element(&ms, hints, context); + if (errnum != 0) + return (errnum); + } +Index: lib/libc/iconv/citrus_prop.h +=================================================================== +--- lib/libc/iconv/citrus_prop.h (revision 267591) ++++ lib/libc/iconv/citrus_prop.h (working copy) +@@ -42,7 +42,7 @@ typedef struct _citrus_prop_hint_t _citrus_prop_hi + + #define _CITRUS_PROP_CB0_T(_func_, _type_) \ + typedef int (*_citrus_prop_##_func_##_cb_func_t) \ +- (void ** __restrict, const char *, _type_); \ ++ (void * __restrict, const char *, _type_); \ + typedef struct { \ + _citrus_prop_##_func_##_cb_func_t func; \ + } _citrus_prop_##_func_##_cb_t; +@@ -52,7 +52,7 @@ _CITRUS_PROP_CB0_T(str, const char *) + + #define _CITRUS_PROP_CB1_T(_func_, _type_) \ + typedef int (*_citrus_prop_##_func_##_cb_func_t) \ +- (void ** __restrict, const char *, _type_, _type_); \ ++ (void * __restrict, const char *, _type_, _type_); \ + typedef struct { \ + _citrus_prop_##_func_##_cb_func_t func; \ + } _citrus_prop_##_func_##_cb_t; +Index: lib/libiconv_modules/BIG5/citrus_big5.c +=================================================================== +--- lib/libiconv_modules/BIG5/citrus_big5.c (revision 267591) ++++ lib/libiconv_modules/BIG5/citrus_big5.c (working copy) +@@ -170,7 +170,7 @@ _citrus_BIG5_check_excludes(_BIG5EncodingInfo *ei, + } + + static int +-_citrus_BIG5_fill_rowcol(void ** __restrict ctx, const char * __restrict s, ++_citrus_BIG5_fill_rowcol(void * __restrict ctx, const char * __restrict s, + uint64_t start, uint64_t end) + { + _BIG5EncodingInfo *ei; +@@ -189,7 +189,7 @@ static int + + static int + /*ARGSUSED*/ +-_citrus_BIG5_fill_excludes(void ** __restrict ctx, ++_citrus_BIG5_fill_excludes(void * __restrict ctx, + const char * __restrict s __unused, uint64_t start, uint64_t end) + { + _BIG5EncodingInfo *ei; +@@ -235,7 +235,6 @@ static int + _citrus_BIG5_encoding_module_init(_BIG5EncodingInfo * __restrict ei, + const void * __restrict var, size_t lenvar) + { +- void *ctx = (void *)ei; + const char *s; + int err; + +@@ -257,9 +256,9 @@ _citrus_BIG5_encoding_module_init(_BIG5EncodingInf + } + + /* fallback Big5-1984, for backward compatibility. */ +- _citrus_BIG5_fill_rowcol((void **)&ctx, "row", 0xA1, 0xFE); +- _citrus_BIG5_fill_rowcol((void **)&ctx, "col", 0x40, 0x7E); +- _citrus_BIG5_fill_rowcol((void **)&ctx, "col", 0xA1, 0xFE); ++ _citrus_BIG5_fill_rowcol(ei, "row", 0xA1, 0xFE); ++ _citrus_BIG5_fill_rowcol(ei, "col", 0x40, 0x7E); ++ _citrus_BIG5_fill_rowcol(ei, "col", 0xA1, 0xFE); + + return (0); + } +Index: lib/libiconv_modules/HZ/citrus_hz.c +=================================================================== +--- lib/libiconv_modules/HZ/citrus_hz.c (revision 267591) ++++ lib/libiconv_modules/HZ/citrus_hz.c (working copy) +@@ -65,8 +65,8 @@ typedef enum { + } charset_t; + + typedef struct { ++ int start; + int end; +- int start; + int width; + } range_t; + +@@ -503,12 +503,12 @@ _citrus_HZ_encoding_module_uninit(_HZEncodingInfo + } + + static int +-_citrus_HZ_parse_char(void **context, const char *name __unused, const char *s) ++_citrus_HZ_parse_char(void *context, const char *name __unused, const char *s) + { + escape_t *escape; + void **p; + +- p = (void **)*context; ++ p = (void **)context; + escape = (escape_t *)p[0]; + if (escape->ch != '\0') + return (EINVAL); +@@ -520,7 +520,7 @@ static int + } + + static int +-_citrus_HZ_parse_graphic(void **context, const char *name, const char *s) ++_citrus_HZ_parse_graphic(void *context, const char *name, const char *s) + { + _HZEncodingInfo *ei; + escape_t *escape; +@@ -527,7 +527,7 @@ static int + graphic_t *graphic; + void **p; + +- p = (void **)*context; ++ p = (void **)context; + escape = (escape_t *)p[0]; + ei = (_HZEncodingInfo *)p[1]; + graphic = malloc(sizeof(*graphic)); +@@ -589,13 +589,13 @@ _CITRUS_PROP_HINT_END + }; + + static int +-_citrus_HZ_parse_escape(void **context, const char *name, const char *s) ++_citrus_HZ_parse_escape(void *context, const char *name, const char *s) + { + _HZEncodingInfo *ei; + escape_t *escape; + void *p[2]; + +- ei = (_HZEncodingInfo *)*context; ++ ei = (_HZEncodingInfo *)context; + escape = malloc(sizeof(*escape)); + if (escape == NULL) + return (EINVAL); +Index: lib/libiconv_modules/VIQR/citrus_viqr.c +=================================================================== +--- lib/libiconv_modules/VIQR/citrus_viqr.c (revision 267591) ++++ lib/libiconv_modules/VIQR/citrus_viqr.c (working copy) +@@ -431,7 +431,6 @@ static int + _citrus_VIQR_encoding_module_init(_VIQREncodingInfo * __restrict ei, + const void * __restrict var __unused, size_t lenvar __unused) + { +- const mnemonic_def_t *p; + const char *s; + size_t i, n; + int errnum; +@@ -455,7 +454,10 @@ _citrus_VIQR_encoding_module_init(_VIQREncodingInf + return (errnum); + } + } +- for (i = 0;; ++i) { ++ /* a + 1 < b + 1 here to silence gcc warning about unsigned < 0. */ ++ for (i = 0; i + 1 < mnemonic_ext_size + 1; ++i) { ++ const mnemonic_def_t *p; ++ + p = &mnemonic_ext[i]; + n = strlen(p->name); + if (ei->mb_cur_max < n) Added: user/cperciva/freebsd-update-build/patches/10.0-RELEASE/6-SA-14:16.file ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/patches/10.0-RELEASE/6-SA-14:16.file Tue Jul 8 04:51:42 2014 (r268382) @@ -0,0 +1,276 @@ +Index: contrib/file/Magdir/commands +=================================================================== +--- contrib/file/Magdir/commands (revision 267806) ++++ contrib/file/Magdir/commands (working copy) +@@ -49,7 +49,8 @@ + !:mime text/x-awk + 0 string/wt #!\ /usr/bin/awk awk script text executable + !:mime text/x-awk +-0 regex =^\\s*BEGIN\\s*[{] awk script text ++0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text ++!:strength - 12 + + # AT&T Bell Labs' Plan 9 shell + 0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable +Index: contrib/file/ascmagic.c +=================================================================== +--- contrib/file/ascmagic.c (revision 267806) ++++ contrib/file/ascmagic.c (working copy) +@@ -147,7 +147,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, + == NULL) + goto done; + if ((rv = file_softmagic(ms, utf8_buf, +- (size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0) ++ (size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0) + rv = -1; + } + +Index: contrib/file/file.h +=================================================================== +--- contrib/file/file.h (revision 267806) ++++ contrib/file/file.h (working copy) +@@ -414,7 +414,7 @@ protected int file_encoding(struct magic_set *, co + unichar **, size_t *, const char **, const char **, const char **); + protected int file_is_tar(struct magic_set *, const unsigned char *, size_t); + protected int file_softmagic(struct magic_set *, const unsigned char *, size_t, +- int, int); ++ size_t, int, int); + protected struct mlist *file_apprentice(struct magic_set *, const char *, int); + protected uint64_t file_signextend(struct magic_set *, struct magic *, + uint64_t); +Index: contrib/file/funcs.c +=================================================================== +--- contrib/file/funcs.c (revision 267806) ++++ contrib/file/funcs.c (working copy) +@@ -228,7 +228,7 @@ file_buffer(struct magic_set *ms, int fd, const ch + + /* try soft magic tests */ + if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) +- if ((m = file_softmagic(ms, ubuf, nb, BINTEST, ++ if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST, + looks_text)) != 0) { + if ((ms->flags & MAGIC_DEBUG) != 0) + (void)fprintf(stderr, "softmagic %d\n", m); +Index: contrib/file/softmagic.c +=================================================================== +--- contrib/file/softmagic.c (revision 267806) ++++ contrib/file/softmagic.c (working copy) +@@ -43,9 +43,9 @@ FILE_RCSID("@(#)$File: softmagic.c,v 1.147 2011/11 + + + private int match(struct magic_set *, struct magic *, uint32_t, +- const unsigned char *, size_t, int, int); ++ const unsigned char *, size_t, int, int, int); + private int mget(struct magic_set *, const unsigned char *, +- struct magic *, size_t, unsigned int, int); ++ struct magic *, size_t, unsigned int, int, int); + private int magiccheck(struct magic_set *, struct magic *); + private int32_t mprint(struct magic_set *, struct magic *); + private int32_t moffset(struct magic_set *, struct magic *); +@@ -60,6 +60,7 @@ private void cvt_16(union VALUETYPE *, const struc + private void cvt_32(union VALUETYPE *, const struct magic *); + private void cvt_64(union VALUETYPE *, const struct magic *); + ++#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) + /* + * softmagic - lookup one file in parsed, in-memory copy of database + * Passed the name and FILE * of one file to be typed. +@@ -67,13 +68,13 @@ private void cvt_64(union VALUETYPE *, const struc + /*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */ + protected int + file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes, +- int mode, int text) ++ size_t level, int mode, int text) + { + struct mlist *ml; + int rv; + for (ml = ms->mlist->next; ml != ms->mlist; ml = ml->next) + if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, mode, +- text)) != 0) ++ text, level)) != 0) + return rv; + + return 0; +@@ -108,7 +109,8 @@ file_softmagic(struct magic_set *ms, const unsigne + */ + private int + match(struct magic_set *ms, struct magic *magic, uint32_t nmagic, +- const unsigned char *s, size_t nbytes, int mode, int text) ++ const unsigned char *s, size_t nbytes, int mode, int text, ++ int recursion_level) + { + uint32_t magindex = 0; + unsigned int cont_level = 0; +@@ -140,7 +142,7 @@ match(struct magic_set *ms, struct magic *magic, u + ms->line = m->lineno; + + /* if main entry matches, print it... */ +- switch (mget(ms, s, m, nbytes, cont_level, text)) { ++ switch (mget(ms, s, m, nbytes, cont_level, text, recursion_level + 1)) { + case -1: + return -1; + case 0: +@@ -223,7 +225,7 @@ match(struct magic_set *ms, struct magic *magic, u + continue; + } + #endif +- switch (mget(ms, s, m, nbytes, cont_level, text)) { ++ switch (mget(ms, s, m, nbytes, cont_level, text, recursion_level + 1)) { + case -1: + return -1; + case 0: +@@ -1018,12 +1020,18 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, in + + private int + mget(struct magic_set *ms, const unsigned char *s, +- struct magic *m, size_t nbytes, unsigned int cont_level, int text) ++ struct magic *m, size_t nbytes, unsigned int cont_level, int text, ++ int recursion_level) + { + uint32_t offset = ms->offset; + uint32_t count = m->str_range; + union VALUETYPE *p = &ms->ms_value; + ++ if (recursion_level >= 20) { ++ file_error(ms, 0, "recursion nesting exceeded"); ++ return -1; ++ } ++ + if (mcopy(ms, p, m->type, m->flag & INDIR, s, offset, nbytes, count) == -1) + return -1; + +@@ -1073,7 +1081,7 @@ mget(struct magic_set *ms, const unsigned char *s, + } + switch (m->in_type) { + case FILE_BYTE: +- if (nbytes < (offset + 1)) ++ if (OFFSET_OOB(nbytes, offset, 1)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1108,7 +1116,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_BESHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1160,7 +1168,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_LESHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1212,7 +1220,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_SHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1249,7 +1257,7 @@ mget(struct magic_set *ms, const unsigned char *s, + break; + case FILE_BELONG: + case FILE_BEID3: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1320,7 +1328,7 @@ mget(struct magic_set *ms, const unsigned char *s, + break; + case FILE_LELONG: + case FILE_LEID3: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1390,7 +1398,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_MELONG: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1460,7 +1468,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_LONG: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1527,7 +1535,7 @@ mget(struct magic_set *ms, const unsigned char *s, + /* Verify we have enough data to match magic type */ + switch (m->type) { + case FILE_BYTE: +- if (nbytes < (offset + 1)) /* should alway be true */ ++ if (OFFSET_OOB(nbytes, offset, 1)) + return 0; + break; + +@@ -1534,7 +1542,7 @@ mget(struct magic_set *ms, const unsigned char *s, + case FILE_SHORT: + case FILE_BESHORT: + case FILE_LESHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + break; + +@@ -1553,7 +1561,7 @@ mget(struct magic_set *ms, const unsigned char *s, + case FILE_FLOAT: + case FILE_BEFLOAT: + case FILE_LEFLOAT: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + break; + +@@ -1560,7 +1568,7 @@ mget(struct magic_set *ms, const unsigned char *s, + case FILE_DOUBLE: + case FILE_BEDOUBLE: + case FILE_LEDOUBLE: +- if (nbytes < (offset + 8)) ++ if (OFFSET_OOB(nbytes, offset, 8)) + return 0; + break; + +@@ -1567,7 +1575,7 @@ mget(struct magic_set *ms, const unsigned char *s, + case FILE_STRING: + case FILE_PSTRING: + case FILE_SEARCH: +- if (nbytes < (offset + m->vallen)) ++ if (OFFSET_OOB(nbytes, offset, m->vallen)) + return 0; + break; + +@@ -1577,6 +1585,8 @@ mget(struct magic_set *ms, const unsigned char *s, + break; + + case FILE_INDIRECT: ++ if (offset == 0) ++ return 0; + if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && + file_printf(ms, "%s", m->desc) == -1) + return -1; +@@ -1583,7 +1593,7 @@ mget(struct magic_set *ms, const unsigned char *s, + if (nbytes < offset) + return 0; + return file_softmagic(ms, s + offset, nbytes - offset, +- BINTEST, text); ++ recursion_level, BINTEST, text); + + case FILE_DEFAULT: /* nothing to check */ + default: Added: user/cperciva/freebsd-update-build/patches/9.1-RELEASE/16-EN-14:08.heimdal ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/patches/9.1-RELEASE/16-EN-14:08.heimdal Tue Jul 8 04:51:42 2014 (r268382) @@ -0,0 +1,13 @@ +Index: crypto/heimdal/lib/gssapi/krb5/prf.c +=================================================================== +--- crypto/heimdal/lib/gssapi/krb5/prf.c (revision 267806) ++++ crypto/heimdal/lib/gssapi/krb5/prf.c (working copy) +@@ -117,7 +117,7 @@ _gsskrb5_pseudo_random(OM_uint32 *minor_status, + num = 0; + p = prf_out->value; + while(desired_output_len > 0) { +- _gsskrb5_encode_om_uint32(num, input.data); ++ _gsskrb5_encode_be_om_uint32(num, input.data); + ret = krb5_crypto_prf(context, crypto, &input, &output); + if (ret) { + OM_uint32 junk; Added: user/cperciva/freebsd-update-build/patches/9.1-RELEASE/16-SA-14:16.file ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/patches/9.1-RELEASE/16-SA-14:16.file Tue Jul 8 04:51:42 2014 (r268382) @@ -0,0 +1,276 @@ +Index: contrib/file/Magdir/commands +=================================================================== +--- contrib/file/Magdir/commands (revision 267806) ++++ contrib/file/Magdir/commands (working copy) +@@ -49,7 +49,8 @@ + !:mime text/x-awk + 0 string/wt #!\ /usr/bin/awk awk script text executable + !:mime text/x-awk +-0 regex =^\\s*BEGIN\\s*[{] awk script text ++0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text ++!:strength - 12 + + # AT&T Bell Labs' Plan 9 shell + 0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable +Index: contrib/file/ascmagic.c +=================================================================== +--- contrib/file/ascmagic.c (revision 267806) ++++ contrib/file/ascmagic.c (working copy) +@@ -147,7 +147,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, + == NULL) + goto done; + if ((rv = file_softmagic(ms, utf8_buf, +- (size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0) ++ (size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0) + rv = -1; + } + +Index: contrib/file/file.h +=================================================================== +--- contrib/file/file.h (revision 267806) ++++ contrib/file/file.h (working copy) +@@ -414,7 +414,7 @@ protected int file_encoding(struct magic_set *, co + unichar **, size_t *, const char **, const char **, const char **); + protected int file_is_tar(struct magic_set *, const unsigned char *, size_t); + protected int file_softmagic(struct magic_set *, const unsigned char *, size_t, +- int, int); ++ size_t, int, int); + protected struct mlist *file_apprentice(struct magic_set *, const char *, int); + protected uint64_t file_signextend(struct magic_set *, struct magic *, + uint64_t); +Index: contrib/file/funcs.c +=================================================================== +--- contrib/file/funcs.c (revision 267806) ++++ contrib/file/funcs.c (working copy) +@@ -228,7 +228,7 @@ file_buffer(struct magic_set *ms, int fd, const ch + + /* try soft magic tests */ + if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) +- if ((m = file_softmagic(ms, ubuf, nb, BINTEST, ++ if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST, + looks_text)) != 0) { + if ((ms->flags & MAGIC_DEBUG) != 0) + (void)fprintf(stderr, "softmagic %d\n", m); +Index: contrib/file/softmagic.c +=================================================================== +--- contrib/file/softmagic.c (revision 267806) ++++ contrib/file/softmagic.c (working copy) +@@ -43,9 +43,9 @@ FILE_RCSID("@(#)$File: softmagic.c,v 1.147 2011/11 + + + private int match(struct magic_set *, struct magic *, uint32_t, +- const unsigned char *, size_t, int, int); ++ const unsigned char *, size_t, int, int, int); + private int mget(struct magic_set *, const unsigned char *, +- struct magic *, size_t, unsigned int, int); ++ struct magic *, size_t, unsigned int, int, int); + private int magiccheck(struct magic_set *, struct magic *); + private int32_t mprint(struct magic_set *, struct magic *); + private int32_t moffset(struct magic_set *, struct magic *); +@@ -60,6 +60,7 @@ private void cvt_16(union VALUETYPE *, const struc + private void cvt_32(union VALUETYPE *, const struct magic *); + private void cvt_64(union VALUETYPE *, const struct magic *); + ++#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) + /* + * softmagic - lookup one file in parsed, in-memory copy of database + * Passed the name and FILE * of one file to be typed. +@@ -67,13 +68,13 @@ private void cvt_64(union VALUETYPE *, const struc + /*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */ + protected int + file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes, +- int mode, int text) ++ size_t level, int mode, int text) + { + struct mlist *ml; + int rv; + for (ml = ms->mlist->next; ml != ms->mlist; ml = ml->next) + if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, mode, +- text)) != 0) ++ text, level)) != 0) + return rv; + + return 0; +@@ -108,7 +109,8 @@ file_softmagic(struct magic_set *ms, const unsigne + */ + private int + match(struct magic_set *ms, struct magic *magic, uint32_t nmagic, +- const unsigned char *s, size_t nbytes, int mode, int text) ++ const unsigned char *s, size_t nbytes, int mode, int text, ++ int recursion_level) + { + uint32_t magindex = 0; + unsigned int cont_level = 0; +@@ -140,7 +142,7 @@ match(struct magic_set *ms, struct magic *magic, u + ms->line = m->lineno; + + /* if main entry matches, print it... */ +- switch (mget(ms, s, m, nbytes, cont_level, text)) { ++ switch (mget(ms, s, m, nbytes, cont_level, text, recursion_level + 1)) { + case -1: + return -1; + case 0: +@@ -223,7 +225,7 @@ match(struct magic_set *ms, struct magic *magic, u + continue; + } + #endif +- switch (mget(ms, s, m, nbytes, cont_level, text)) { ++ switch (mget(ms, s, m, nbytes, cont_level, text, recursion_level + 1)) { + case -1: + return -1; + case 0: +@@ -1018,12 +1020,18 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, in + + private int + mget(struct magic_set *ms, const unsigned char *s, +- struct magic *m, size_t nbytes, unsigned int cont_level, int text) ++ struct magic *m, size_t nbytes, unsigned int cont_level, int text, ++ int recursion_level) + { + uint32_t offset = ms->offset; + uint32_t count = m->str_range; + union VALUETYPE *p = &ms->ms_value; + ++ if (recursion_level >= 20) { ++ file_error(ms, 0, "recursion nesting exceeded"); ++ return -1; ++ } ++ + if (mcopy(ms, p, m->type, m->flag & INDIR, s, offset, nbytes, count) == -1) + return -1; + +@@ -1073,7 +1081,7 @@ mget(struct magic_set *ms, const unsigned char *s, + } + switch (m->in_type) { + case FILE_BYTE: +- if (nbytes < (offset + 1)) ++ if (OFFSET_OOB(nbytes, offset, 1)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1108,7 +1116,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_BESHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1160,7 +1168,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_LESHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1212,7 +1220,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_SHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1249,7 +1257,7 @@ mget(struct magic_set *ms, const unsigned char *s, + break; + case FILE_BELONG: + case FILE_BEID3: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1320,7 +1328,7 @@ mget(struct magic_set *ms, const unsigned char *s, + break; + case FILE_LELONG: + case FILE_LEID3: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1390,7 +1398,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_MELONG: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1460,7 +1468,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_LONG: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1527,7 +1535,7 @@ mget(struct magic_set *ms, const unsigned char *s, + /* Verify we have enough data to match magic type */ + switch (m->type) { + case FILE_BYTE: +- if (nbytes < (offset + 1)) /* should alway be true */ ++ if (OFFSET_OOB(nbytes, offset, 1)) + return 0; + break; + +@@ -1534,7 +1542,7 @@ mget(struct magic_set *ms, const unsigned char *s, + case FILE_SHORT: + case FILE_BESHORT: + case FILE_LESHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + break; + +@@ -1553,7 +1561,7 @@ mget(struct magic_set *ms, const unsigned char *s, + case FILE_FLOAT: + case FILE_BEFLOAT: + case FILE_LEFLOAT: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + break; + +@@ -1560,7 +1568,7 @@ mget(struct magic_set *ms, const unsigned char *s, + case FILE_DOUBLE: + case FILE_BEDOUBLE: + case FILE_LEDOUBLE: +- if (nbytes < (offset + 8)) ++ if (OFFSET_OOB(nbytes, offset, 8)) + return 0; + break; + +@@ -1567,7 +1575,7 @@ mget(struct magic_set *ms, const unsigned char *s, + case FILE_STRING: + case FILE_PSTRING: + case FILE_SEARCH: +- if (nbytes < (offset + m->vallen)) ++ if (OFFSET_OOB(nbytes, offset, m->vallen)) + return 0; + break; + +@@ -1577,6 +1585,8 @@ mget(struct magic_set *ms, const unsigned char *s, + break; + + case FILE_INDIRECT: ++ if (offset == 0) ++ return 0; + if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && + file_printf(ms, "%s", m->desc) == -1) + return -1; +@@ -1583,7 +1593,7 @@ mget(struct magic_set *ms, const unsigned char *s, + if (nbytes < offset) + return 0; + return file_softmagic(ms, s + offset, nbytes - offset, +- BINTEST, text); ++ recursion_level, BINTEST, text); + + case FILE_DEFAULT: /* nothing to check */ + default: Added: user/cperciva/freebsd-update-build/patches/9.2-RELEASE/9-EN-14:08.heimdal ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/patches/9.2-RELEASE/9-EN-14:08.heimdal Tue Jul 8 04:51:42 2014 (r268382) @@ -0,0 +1,13 @@ +Index: crypto/heimdal/lib/gssapi/krb5/prf.c +=================================================================== +--- crypto/heimdal/lib/gssapi/krb5/prf.c (revision 267806) ++++ crypto/heimdal/lib/gssapi/krb5/prf.c (working copy) +@@ -117,7 +117,7 @@ _gsskrb5_pseudo_random(OM_uint32 *minor_status, + num = 0; + p = prf_out->value; + while(desired_output_len > 0) { +- _gsskrb5_encode_om_uint32(num, input.data); ++ _gsskrb5_encode_be_om_uint32(num, input.data); + ret = krb5_crypto_prf(context, crypto, &input, &output); + if (ret) { + OM_uint32 junk; Added: user/cperciva/freebsd-update-build/patches/9.2-RELEASE/9-SA-14:16.file ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/cperciva/freebsd-update-build/patches/9.2-RELEASE/9-SA-14:16.file Tue Jul 8 04:51:42 2014 (r268382) @@ -0,0 +1,276 @@ +Index: contrib/file/Magdir/commands +=================================================================== +--- contrib/file/Magdir/commands (revision 267806) ++++ contrib/file/Magdir/commands (working copy) +@@ -49,7 +49,8 @@ + !:mime text/x-awk + 0 string/wt #!\ /usr/bin/awk awk script text executable + !:mime text/x-awk +-0 regex =^\\s*BEGIN\\s*[{] awk script text ++0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text ++!:strength - 12 + + # AT&T Bell Labs' Plan 9 shell + 0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable +Index: contrib/file/ascmagic.c +=================================================================== +--- contrib/file/ascmagic.c (revision 267806) ++++ contrib/file/ascmagic.c (working copy) +@@ -147,7 +147,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, + == NULL) + goto done; + if ((rv = file_softmagic(ms, utf8_buf, +- (size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0) ++ (size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0) + rv = -1; + } + +Index: contrib/file/file.h +=================================================================== +--- contrib/file/file.h (revision 267806) ++++ contrib/file/file.h (working copy) +@@ -414,7 +414,7 @@ protected int file_encoding(struct magic_set *, co + unichar **, size_t *, const char **, const char **, const char **); + protected int file_is_tar(struct magic_set *, const unsigned char *, size_t); + protected int file_softmagic(struct magic_set *, const unsigned char *, size_t, +- int, int); ++ size_t, int, int); + protected struct mlist *file_apprentice(struct magic_set *, const char *, int); + protected uint64_t file_signextend(struct magic_set *, struct magic *, + uint64_t); +Index: contrib/file/funcs.c +=================================================================== +--- contrib/file/funcs.c (revision 267806) ++++ contrib/file/funcs.c (working copy) +@@ -228,7 +228,7 @@ file_buffer(struct magic_set *ms, int fd, const ch + + /* try soft magic tests */ + if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) +- if ((m = file_softmagic(ms, ubuf, nb, BINTEST, ++ if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST, + looks_text)) != 0) { + if ((ms->flags & MAGIC_DEBUG) != 0) + (void)fprintf(stderr, "softmagic %d\n", m); +Index: contrib/file/softmagic.c +=================================================================== +--- contrib/file/softmagic.c (revision 267806) ++++ contrib/file/softmagic.c (working copy) +@@ -43,9 +43,9 @@ FILE_RCSID("@(#)$File: softmagic.c,v 1.147 2011/11 + + + private int match(struct magic_set *, struct magic *, uint32_t, +- const unsigned char *, size_t, int, int); ++ const unsigned char *, size_t, int, int, int); + private int mget(struct magic_set *, const unsigned char *, +- struct magic *, size_t, unsigned int, int); ++ struct magic *, size_t, unsigned int, int, int); + private int magiccheck(struct magic_set *, struct magic *); + private int32_t mprint(struct magic_set *, struct magic *); + private int32_t moffset(struct magic_set *, struct magic *); +@@ -60,6 +60,7 @@ private void cvt_16(union VALUETYPE *, const struc + private void cvt_32(union VALUETYPE *, const struct magic *); + private void cvt_64(union VALUETYPE *, const struct magic *); + ++#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o))) + /* + * softmagic - lookup one file in parsed, in-memory copy of database + * Passed the name and FILE * of one file to be typed. +@@ -67,13 +68,13 @@ private void cvt_64(union VALUETYPE *, const struc + /*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */ + protected int + file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes, +- int mode, int text) ++ size_t level, int mode, int text) + { + struct mlist *ml; + int rv; + for (ml = ms->mlist->next; ml != ms->mlist; ml = ml->next) + if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, mode, +- text)) != 0) ++ text, level)) != 0) + return rv; + + return 0; +@@ -108,7 +109,8 @@ file_softmagic(struct magic_set *ms, const unsigne + */ + private int + match(struct magic_set *ms, struct magic *magic, uint32_t nmagic, +- const unsigned char *s, size_t nbytes, int mode, int text) ++ const unsigned char *s, size_t nbytes, int mode, int text, ++ int recursion_level) + { + uint32_t magindex = 0; + unsigned int cont_level = 0; +@@ -140,7 +142,7 @@ match(struct magic_set *ms, struct magic *magic, u + ms->line = m->lineno; + + /* if main entry matches, print it... */ +- switch (mget(ms, s, m, nbytes, cont_level, text)) { ++ switch (mget(ms, s, m, nbytes, cont_level, text, recursion_level + 1)) { + case -1: + return -1; + case 0: +@@ -223,7 +225,7 @@ match(struct magic_set *ms, struct magic *magic, u + continue; + } + #endif +- switch (mget(ms, s, m, nbytes, cont_level, text)) { ++ switch (mget(ms, s, m, nbytes, cont_level, text, recursion_level + 1)) { + case -1: + return -1; + case 0: +@@ -1018,12 +1020,18 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, in + + private int + mget(struct magic_set *ms, const unsigned char *s, +- struct magic *m, size_t nbytes, unsigned int cont_level, int text) ++ struct magic *m, size_t nbytes, unsigned int cont_level, int text, ++ int recursion_level) + { + uint32_t offset = ms->offset; + uint32_t count = m->str_range; + union VALUETYPE *p = &ms->ms_value; + ++ if (recursion_level >= 20) { ++ file_error(ms, 0, "recursion nesting exceeded"); ++ return -1; ++ } ++ + if (mcopy(ms, p, m->type, m->flag & INDIR, s, offset, nbytes, count) == -1) + return -1; + +@@ -1073,7 +1081,7 @@ mget(struct magic_set *ms, const unsigned char *s, + } + switch (m->in_type) { + case FILE_BYTE: +- if (nbytes < (offset + 1)) ++ if (OFFSET_OOB(nbytes, offset, 1)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1108,7 +1116,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_BESHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1160,7 +1168,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_LESHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1212,7 +1220,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_SHORT: +- if (nbytes < (offset + 2)) ++ if (OFFSET_OOB(nbytes, offset, 2)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1249,7 +1257,7 @@ mget(struct magic_set *ms, const unsigned char *s, + break; + case FILE_BELONG: + case FILE_BEID3: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1320,7 +1328,7 @@ mget(struct magic_set *ms, const unsigned char *s, + break; + case FILE_LELONG: + case FILE_LEID3: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1390,7 +1398,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_MELONG: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { +@@ -1460,7 +1468,7 @@ mget(struct magic_set *ms, const unsigned char *s, + offset = ~offset; + break; + case FILE_LONG: +- if (nbytes < (offset + 4)) ++ if (OFFSET_OOB(nbytes, offset, 4)) + return 0; + if (off) { + switch (m->in_op & FILE_OPS_MASK) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407080451.s684ph1P024531>