diff options
author | Dan Robertson <danlrobertson89@gmail.com> | 2018-04-28 03:18:00 +0000 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-04-30 23:02:01 -0600 |
commit | 1632f8baf04e7351f387e58957fc04498d90987d (patch) | |
tree | cf269dd68ec1db621ddadd18abe7851d1f249318 /gdb/rust-exp.y | |
parent | e31efe56455e4a0e84d2157e942e51f8ac94e9fc (diff) | |
download | gdb-1632f8baf04e7351f387e58957fc04498d90987d.zip gdb-1632f8baf04e7351f387e58957fc04498d90987d.tar.gz gdb-1632f8baf04e7351f387e58957fc04498d90987d.tar.bz2 |
rust: Fix null deref when casting (PR 23124)
Fix a null dereference when casting a value to a unit type.
ChangeLog
2018-04-28 Dan Robertson <danlrobertson89@gmail.com>
PR rust/23124
* gdb/rust-exp.y (convert_params_to_types): Ensure that the params
pointer is not null before dereferencing it.
testsuite/ChangeLog
2018-04-28 Dan Robertson <danlrobertson89@gmail.com>
PR rust/23124
* gdb.rust/expr.exp: Test that the unit type is correctly parsed
when casting.
Diffstat (limited to 'gdb/rust-exp.y')
-rw-r--r-- | gdb/rust-exp.y | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y index 56aa689..9f21498 100644 --- a/gdb/rust-exp.y +++ b/gdb/rust-exp.y @@ -2019,8 +2019,11 @@ convert_params_to_types (struct parser_state *state, rust_op_vector *params) { std::vector<struct type *> result; - for (const rust_op *op : *params) - result.push_back (convert_ast_to_type (state, op)); + if (params != nullptr) + { + for (const rust_op *op : *params) + result.push_back (convert_ast_to_type (state, op)); + } return result; } |