MdeModulePkg/RegularExpressionDxe: Miss null pointer check

Oniguruma https://github.com/kkos/oniguruma
this change is merged from oniguruma develop branch.
from commit 396a757dffafc0c7eb269433c29a0ba961d73ad6.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dongao Guo <dongao.guo@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Dongao Guo 2018-10-11 14:57:00 +08:00 committed by Liming Gao
parent f1400101a7
commit 16bd7c35df
1 changed files with 6 additions and 3 deletions

View File

@ -7725,8 +7725,9 @@ parse_exp(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
case TK_ALT: case TK_ALT:
case TK_EOT: case TK_EOT:
end_of_token: end_of_token:
*np = node_new_empty(); *np = node_new_empty();
return tok->type; CHECK_NULL_RETURN_MEMERR(*np);
return tok->type;
break; break;
case TK_SUBEXP_OPEN: case TK_SUBEXP_OPEN:
@ -7977,8 +7978,10 @@ parse_exp(Node** np, OnigToken* tok, int term, UChar** src, UChar* end,
if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS)) { if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS)) {
if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS)) if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS))
return ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED; return ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED;
else else {
*np = node_new_empty(); *np = node_new_empty();
CHECK_NULL_RETURN_MEMERR(*np);
}
} }
else { else {
goto tk_byte; goto tk_byte;