]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ChangeLog
Check objfile->sf in ada-lang.c
authorTom Tromey <tromey@adacore.com>
Tue, 2 Mar 2021 18:57:01 +0000 (11:57 -0700)
committerTom Tromey <tromey@adacore.com>
Tue, 2 Mar 2021 19:00:44 +0000 (12:00 -0700)
commit1228719f312c22a3ce4ade10d175b80ac5cedb08
tree6d54243422cec0008c6fb60a7b77ea5aa09dc4de
parentca8f6bc629cb27792ce449e7253c74a3f6f75fda
Check objfile->sf in ada-lang.c

Most places in gdb that reference objfile->sf also check that it is
not null.  It is valid for it to be null, because find_sym_fns can
return null for some kinds of object file.  However, it's rare to
encounter this scenario with Ada code.  I only encountered it when
looking at a fork of gdb that, I believe, makes its own objfiles
without setting 'sf'.

This patch changes ada-lang.c to check this field before using it.
This avoids any potential crash here.  There's no test case because
I'm not even sure this is possible to trip over with an unmodified
gdb.

There are some other unchecked uses in gdb, but at a quick glance they
all seem to be involved with symbol reading, which of course won't
happen when sf==null.

gdb/ChangeLog
2021-03-02  Tom Tromey  <tromey@adacore.com>

* ada-lang.c (add_nonlocal_symbols): Handle case where objfile->sf
is null.
gdb/ChangeLog
gdb/ada-lang.c