From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mx.groups.io with SMTP id smtpd.web11.2166.1605577786405461893 for ; Mon, 16 Nov 2020 17:49:46 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.190, mailfrom: xiewenyi2@huawei.com) Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CZplY5PWcz15LKg; Tue, 17 Nov 2020 09:49:29 +0800 (CST) Received: from [10.174.153.72] (10.174.153.72) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Tue, 17 Nov 2020 09:49:36 +0800 Subject: =?UTF-8?B?UmU6IOWbnuWkjTogW1BBVENIIEVESzIgdjEgMS8xXSBCYXNlVG9vbHMvVmZyQ29tcGlsZTogYWRkIE5VTEwgcG9pbnQgY2hlY2s=?= To: gaoliming , CC: , , References: <1605260747-55149-1-git-send-email-xiewenyi2@huawei.com> <1605260747-55149-2-git-send-email-xiewenyi2@huawei.com> <005501d6bc30$657a1500$306e3f00$@byosoft.com.cn> From: "wenyi,xie" Message-ID: Date: Tue, 17 Nov 2020 09:49:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.0.1 MIME-Version: 1.0 In-Reply-To: <005501d6bc30$657a1500$306e3f00$@byosoft.com.cn> X-Originating-IP: [10.174.153.72] X-CFilter-Loop: Reflected Content-Type: text/plain; charset="gbk" Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Liming, I get it and agree with you, since it's just found by code review. Thanks Wenyi On 2020/11/16 23:51, gaoliming wrote: > Wenyi: > Do you meet with the real problem in VfrCompile? Or just find them by= code > review.=20 > Pccts is from the third party code. If no obvious reason, I don't pre= fer > to change it.=20 >=20 > Thanks > Liming >> -----=D3=CA=BC=FE=D4=AD=BC=FE----- >> =B7=A2=BC=FE=C8=CB: Wenyi Xie >> =B7=A2=CB=CD=CA=B1=BC=E4: 2020=C4=EA11=D4=C213=C8=D5 17:46 >> =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io >> =B3=AD=CB=CD: bob.c.feng@intel.com; gaoliming@byosoft.com.cn; >> yuwei.chen@intel.com; songdongkuang@huawei.com; >> xiewenyi2@huawei.com >> =D6=F7=CC=E2: [PATCH EDK2 v1 1/1] BaseTools/VfrCompile: add NULL point= check >> >> add NULL point check after allocating. >> >> Cc: Bob Feng >> Cc: Liming Gao >> Cc: Yuwei Chen >> Signed-off-by: Wenyi Xie >> --- >> BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c >> b/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c >> index 051ee4ec5d28..8c861d1542c6 100644 >> --- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c >> +++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c >> @@ -1704,6 +1704,7 @@ char *s; >> require(ua!=3DNULL, "cannot allocate UserAction"); >> >> ua->action =3D (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); >> + require(ua->action!=3DNULL, "cannot allocate action"); >> strcpy(ua->action, s); >> return ua; >> } >> @@ -1742,6 +1743,7 @@ int altnum; >> char *p; >> sprintf(buf, "_blk%d_alt%d", blockid, altnum); >> p =3D (char *)malloc(strlen(buf)+1); >> + require(expr,err)(expr,err)(p!=3DNULL, "cannot allocate buf"); >> strcpy(p, buf); >> return p; >> } >> -- >> 2.20.1.windows.1 >=20 >=20 >=20 > . >=20