* [PATCH EDK2 v1 1/1] BaseTools/VfrCompile: add NULL point check
2020-11-13 3:30 [PATCH EDK2 v1 0/1] " wenyi,xie
@ 2020-11-13 3:30 ` wenyi,xie
0 siblings, 0 replies; 5+ messages in thread
From: wenyi,xie @ 2020-11-13 3:30 UTC (permalink / raw)
To: devel; +Cc: songdongkuang, xiewenyi2, Bob Feng, Liming Gao, Yuwei Chen
add NULL point check after allocating.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
---
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..122878fc49e9 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!=NULL, "cannot allocate UserAction");
ua->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(ua->action!=NULL, "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 = (char *)malloc(strlen(buf)+1);
+ require(p!=NULL, "cannot allocate buf");
strcpy(p, buf);
return p;
}
--
2.20.1.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH EDK2 v1 0/1] BaseTools/VfrCompile: add NULL point check
@ 2020-11-13 9:45 wenyi,xie
2020-11-13 9:45 ` [PATCH EDK2 v1 1/1] " wenyi,xie
0 siblings, 1 reply; 5+ messages in thread
From: wenyi,xie @ 2020-11-13 9:45 UTC (permalink / raw)
To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, songdongkuang, xiewenyi2
Main Changes :
add NULL point check and log after allocting.
Wenyi Xie (1):
BaseTools/VfrCompile: add NULL point check
BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c | 2 ++
1 file changed, 2 insertions(+)
--
2.20.1.windows.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH EDK2 v1 1/1] BaseTools/VfrCompile: add NULL point check
2020-11-13 9:45 [PATCH EDK2 v1 0/1] BaseTools/VfrCompile: add NULL point check wenyi,xie
@ 2020-11-13 9:45 ` wenyi,xie
2020-11-16 15:51 ` 回复: " gaoliming
0 siblings, 1 reply; 5+ messages in thread
From: wenyi,xie @ 2020-11-13 9:45 UTC (permalink / raw)
To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, songdongkuang, xiewenyi2
add NULL point check after allocating.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
---
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!=NULL, "cannot allocate UserAction");
ua->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+ require(ua->action!=NULL, "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 = (char *)malloc(strlen(buf)+1);
+ require(expr,err)(expr,err)(p!=NULL, "cannot allocate buf");
strcpy(p, buf);
return p;
}
--
2.20.1.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* 回复: [PATCH EDK2 v1 1/1] BaseTools/VfrCompile: add NULL point check
2020-11-13 9:45 ` [PATCH EDK2 v1 1/1] " wenyi,xie
@ 2020-11-16 15:51 ` gaoliming
2020-11-17 1:49 ` wenyi,xie
0 siblings, 1 reply; 5+ messages in thread
From: gaoliming @ 2020-11-16 15:51 UTC (permalink / raw)
To: 'Wenyi Xie', devel; +Cc: bob.c.feng, yuwei.chen, songdongkuang
Wenyi:
Do you meet with the real problem in VfrCompile? Or just find them by code
review.
Pccts is from the third party code. If no obvious reason, I don't prefer
to change it.
Thanks
Liming
> -----邮件原件-----
> 发件人: Wenyi Xie <xiewenyi2@huawei.com>
> 发送时间: 2020年11月13日 17:46
> 收件人: devel@edk2.groups.io
> 抄送: bob.c.feng@intel.com; gaoliming@byosoft.com.cn;
> yuwei.chen@intel.com; songdongkuang@huawei.com;
> xiewenyi2@huawei.com
> 主题: [PATCH EDK2 v1 1/1] BaseTools/VfrCompile: add NULL point check
>
> add NULL point check after allocating.
>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
> ---
> 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!=NULL, "cannot allocate UserAction");
>
> ua->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
> + require(ua->action!=NULL, "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 = (char *)malloc(strlen(buf)+1);
> + require(expr,err)(expr,err)(p!=NULL, "cannot allocate buf");
> strcpy(p, buf);
> return p;
> }
> --
> 2.20.1.windows.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: 回复: [PATCH EDK2 v1 1/1] BaseTools/VfrCompile: add NULL point check
2020-11-16 15:51 ` 回复: " gaoliming
@ 2020-11-17 1:49 ` wenyi,xie
0 siblings, 0 replies; 5+ messages in thread
From: wenyi,xie @ 2020-11-17 1:49 UTC (permalink / raw)
To: gaoliming, devel; +Cc: bob.c.feng, yuwei.chen, songdongkuang
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.
> Pccts is from the third party code. If no obvious reason, I don't prefer
> to change it.
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: Wenyi Xie <xiewenyi2@huawei.com>
>> 发送时间: 2020年11月13日 17:46
>> 收件人: devel@edk2.groups.io
>> 抄送: bob.c.feng@intel.com; gaoliming@byosoft.com.cn;
>> yuwei.chen@intel.com; songdongkuang@huawei.com;
>> xiewenyi2@huawei.com
>> 主题: [PATCH EDK2 v1 1/1] BaseTools/VfrCompile: add NULL point check
>>
>> add NULL point check after allocating.
>>
>> Cc: Bob Feng <bob.c.feng@intel.com>
>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>> Cc: Yuwei Chen <yuwei.chen@intel.com>
>> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
>> ---
>> 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!=NULL, "cannot allocate UserAction");
>>
>> ua->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
>> + require(ua->action!=NULL, "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 = (char *)malloc(strlen(buf)+1);
>> + require(expr,err)(expr,err)(p!=NULL, "cannot allocate buf");
>> strcpy(p, buf);
>> return p;
>> }
>> --
>> 2.20.1.windows.1
>
>
>
> .
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-17 1:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-13 9:45 [PATCH EDK2 v1 0/1] BaseTools/VfrCompile: add NULL point check wenyi,xie
2020-11-13 9:45 ` [PATCH EDK2 v1 1/1] " wenyi,xie
2020-11-16 15:51 ` 回复: " gaoliming
2020-11-17 1:49 ` wenyi,xie
-- strict thread matches above, loose matches on Subject: below --
2020-11-13 3:30 [PATCH EDK2 v1 0/1] " wenyi,xie
2020-11-13 3:30 ` [PATCH EDK2 v1 1/1] " wenyi,xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox