This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] bug 23124: rust - Fix null deref when casting
- From: Tom Tromey <tom at tromey dot com>
- To: Dan Robertson <danlrobertson89 at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 28 Apr 2018 21:49:54 -0600
- Subject: Re: [PATCH] bug 23124: rust - Fix null deref when casting
- References: <20180428032443.GA1869@tomyris>
>>>>> "Dan" == Dan Robertson <danlrobertson89@gmail.com> writes:
Dan> Attached a patch that fixes bug 23124.
Thanks for the patch.
This is the right fix, but there are a few nits. If you want to address
those, that would be nice. If you can't, I will do it on Monday.
It is missing a ChangeLog entry. It's normal to mention the bug in the
ChangeLog, see any of the ones mentioning "PR .../NNNN".
It needs a test, feel free to just drop the simplest thing possible into
gdb/testsuite/gdb.rust/expr.exp. The test suite, for some reason, has a
ChangeLog of its own.
Dan> - for (const rust_op *op : *params)
Dan> - result.push_back (convert_ast_to_type (state, op));
Dan> + if (params) {
Dan> + for (const rust_op *op : *params) {
Dan> + result.push_back (convert_ast_to_type (state, op));
Dan> + }
Dan> + }
In the gdb flavor of GNU style, one would format this as:
if (params != nullptr)
{
for (const rust_op *op : *params)
result.push_back (convert_ast_to_type (state, op));
}
Tom