#include <config.h>
#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__
#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
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;
#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;
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;
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))