From: Ruslan Kuprieiev Date: Thu, 15 Jun 2017 20:20:53 +0000 (+0300) Subject: regexec: return error if xmalloc failed X-Git-Tag: v6.4.0~2^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=39e11681c371ce7a7ed60b524e4819e94d4b8424;p=onig regexec: return error if xmalloc failed "Unchecked return value of 'xmalloc' in 'STACK_SAVE' macro may result in undefined behaviour when its result is passed to xmemcpy." Id: 12 Signed-off-by: Ruslan Kuprieiev --- diff --git a/src/regexec.c b/src/regexec.c index ae39e25..af63580 100644 --- a/src/regexec.c +++ b/src/regexec.c @@ -428,6 +428,7 @@ onig_region_copy(OnigRegion* to, OnigRegion* from) size_t size = sizeof(OnigStackIndex) * msa->ptr_num \ + sizeof(OnigStackType) * msa->stack_n;\ msa->stack_p = xmalloc(size);\ + CHECK_NULL_RETURN_MEMERR(msa->stack_p);\ xmemcpy(msa->stack_p, alloc_base, size);\ }\ else {\