OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
compiler: fix null-dereference on invalid len() arg.
[pf3gnuchains/gcc-fork.git]
/
gcc
/
go
/
gofrontend
/
expressions.cc
diff --git
a/gcc/go/gofrontend/expressions.cc
b/gcc/go/gofrontend/expressions.cc
index
f1e0639
..
13c7de3
100644
(file)
--- a/
gcc/go/gofrontend/expressions.cc
+++ b/
gcc/go/gofrontend/expressions.cc
@@
-6609,7
+6609,7
@@
Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function,
if (this->code_ == BUILTIN_LEN || this->code_ == BUILTIN_CAP)
{
Expression* arg = this->one_arg();
if (this->code_ == BUILTIN_LEN || this->code_ == BUILTIN_CAP)
{
Expression* arg = this->one_arg();
- if (!arg->is_constant())
+ if (
arg != NULL &&
!arg->is_constant())
{
Find_call_expression find_call;
Expression::traverse(&arg, &find_call);
{
Find_call_expression find_call;
Expression::traverse(&arg, &find_call);
@@
-6929,7
+6929,7
@@
Expression*
Builtin_call_expression::one_arg() const
{
const Expression_list* args = this->args();
Builtin_call_expression::one_arg() const
{
const Expression_list* args = this->args();
- if (args->size() != 1)
+ if (args
== NULL || args
->size() != 1)
return NULL;
return args->front();
}
return NULL;
return args->front();
}