From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5A49F2194D3B3 for ; Wed, 10 Oct 2018 23:57:35 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Oct 2018 23:57:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,367,1534834800"; d="scan'208";a="240389600" Received: from shwde7172.ccr.corp.intel.com ([10.239.158.23]) by orsmga004.jf.intel.com with ESMTP; 10 Oct 2018 23:57:34 -0700 From: Liming Gao To: edk2-devel@lists.01.org Cc: Dongao Guo Date: Thu, 11 Oct 2018 14:57:02 +0800 Message-Id: <1539241023-2864-4-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 In-Reply-To: <1539241023-2864-1-git-send-email-liming.gao@intel.com> References: <1539241023-2864-1-git-send-email-liming.gao@intel.com> Subject: [Patch 3/4] MdeModulePkg/RegularExpressionDxe: Miss null pointer check X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2018 06:57:35 -0000 From: Dongao Guo Oniguruma https://github.com/kkos/oniguruma this change is merged from oniguruma develop branch. from commit 1db8a2726dfad0401f928cb8474bd770f07040a7. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dongao Guo Reviewed-by: Liming Gao --- MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c index 5b7fec9..c71ae5f 100644 --- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c +++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regparse.c @@ -1906,6 +1906,7 @@ callout_tag_entry(regex_t* reg, UChar* name, UChar* name_end, if (r != ONIG_NORMAL) return r; ext = onig_get_regex_ext(reg); + CHECK_NULL_RETURN_MEMERR(ext); r = callout_tag_entry_raw(ext->tag_table, name, name_end, entry_val); e = onig_reg_callout_list_at(reg, (int )entry_val); @@ -2088,6 +2089,7 @@ node_new(void) Node* node; node = (Node* )xmalloc(sizeof(Node)); + CHECK_NULL_RETURN(node); xmemset(node, 0, sizeof(*node)); #ifdef DEBUG_NODE_FREE @@ -6616,6 +6618,7 @@ parse_callout_of_contents(Node** np, int cterm, UChar** src, UChar* end, ScanEnv if (r != 0) return r; ext = onig_get_regex_ext(env->reg); + CHECK_NULL_RETURN_MEMERR(ext); if (IS_NULL(ext->pattern)) { r = onig_ext_set_pattern(env->reg, env->pattern, env->pattern_end); if (r != ONIG_NORMAL) return r; @@ -6936,6 +6939,7 @@ parse_callout_of_name(Node** np, int cterm, UChar** src, UChar* end, ScanEnv* en if (r != 0) return r; ext = onig_get_regex_ext(env->reg); + CHECK_NULL_RETURN_MEMERR(ext); if (IS_NULL(ext->pattern)) { r = onig_ext_set_pattern(env->reg, env->pattern, env->pattern_end); if (r != ONIG_NORMAL) return r; @@ -7987,6 +7991,7 @@ parse_exp(Node** np, OnigToken* tok, int term, UChar** src, UChar* end, int ascii_mode = IS_WORD_ASCII(env->options) && IS_WORD_ANCHOR_TYPE(tok->u.anchor) ? 1 : 0; *np = onig_node_new_anchor(tok->u.anchor, ascii_mode); + CHECK_NULL_RETURN_MEMERR(*np); } break; -- 2.10.0.windows.1