From: Apple Date: Tue, 18 Aug 2015 17:17:27 +0000 (+0000) Subject: Libc-1044.40.1.tar.gz X-Git-Tag: os-x-10105^0 X-Git-Url: https://git.saurik.com/apple/libc.git/commitdiff_plain/2acb89982f71719aec26ca16705bd2c0400a9550 Libc-1044.40.1.tar.gz --- diff --git a/regex/TRE/lib/regexec.c b/regex/TRE/lib/regexec.c index 89229fe..6823f72 100644 --- a/regex/TRE/lib/regexec.c +++ b/regex/TRE/lib/regexec.c @@ -10,6 +10,10 @@ #include #endif /* HAVE_CONFIG_H */ +/* Unset TRE_USE_ALLOCA to avoid using the stack to hold all the state + info while running */ +#undef TRE_USE_ALLOCA + #ifdef TRE_USE_ALLOCA /* AIX requires this to be the first thing in the file. */ #ifndef __GNUC__ diff --git a/regex/TRE/lib/tre-match-backtrack.c b/regex/TRE/lib/tre-match-backtrack.c index 734f088..a03d1c6 100644 --- a/regex/TRE/lib/tre-match-backtrack.c +++ b/regex/TRE/lib/tre-match-backtrack.c @@ -274,7 +274,7 @@ tre_tnfa_run_backtrack(const tre_tnfa_t *tnfa, const void *string, int num_tags = tnfa->num_tags; int touch = 1; - char *buf; + char *buf = NULL; int tbytes; #ifdef TRE_MBSTATE diff --git a/regex/TRE/lib/tre-match-parallel.c b/regex/TRE/lib/tre-match-parallel.c index 67726c4..c6ce76f 100644 --- a/regex/TRE/lib/tre-match-parallel.c +++ b/regex/TRE/lib/tre-match-parallel.c @@ -143,7 +143,7 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, int len, #endif /* TRE_DEBUG */ tre_tag_t *tmp_tags = NULL; tre_tag_t *tmp_iptr; - int tbytes; + size_t tbytes; int touch = 1; #ifdef TRE_MBSTATE @@ -162,7 +162,7 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, int len, everything in a single large block from the stack frame using alloca() or with malloc() if alloca is unavailable. */ { - int rbytes, pbytes, total_bytes; + size_t rbytes, pbytes, total_bytes; char *tmp_buf; /* Compute the length of the block we need. */ tbytes = sizeof(*tmp_tags) * num_tags; @@ -177,11 +177,11 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string, int len, #ifdef TRE_USE_ALLOCA buf = alloca(total_bytes); #else /* !TRE_USE_ALLOCA */ - buf = xmalloc((unsigned)total_bytes); + buf = xmalloc(total_bytes); #endif /* !TRE_USE_ALLOCA */ if (buf == NULL) return REG_ESPACE; - memset(buf, 0, (size_t)total_bytes); + memset(buf, 0, total_bytes); /* Get the various pointers within tmp_buf (properly aligned). */ tmp_tags = (void *)buf; diff --git a/regex/TRE/lib/tre-parse.c b/regex/TRE/lib/tre-parse.c index ad09c26..05193af 100644 --- a/regex/TRE/lib/tre-parse.c +++ b/regex/TRE/lib/tre-parse.c @@ -717,7 +717,7 @@ static const char *bracket_match_type_str[] = { static reg_errcode_t tre_parse_bracket(tre_parse_ctx_t *ctx, tre_ast_node_t **result) { - tre_ast_node_t *node; + tre_ast_node_t *node = NULL; reg_errcode_t status = REG_OK; tre_bracket_match_list_t *items; int max_i = 32; @@ -2016,6 +2016,8 @@ tre_parse(tre_parse_ctx_t *ctx) ctx->re++; while (ctx->re_end - ctx->re >= 0) { + if (i == sizeof(tmp)) + return REG_EBRACE; if (ctx->re[0] == CHAR_RBRACE) break; if (tre_isxdigit_l(ctx->re[0], ctx->loc))