[applied] elf-reader: Avoid crashing when looking at non-existing variable symbol

Message ID 87seyq8vme.fsf@redhat.com
State New
Headers
Series [applied] elf-reader: Avoid crashing when looking at non-existing variable symbol |

Commit Message

Dodji Seketeli May 9, 2024, 10:32 p.m. UTC
  Hello,

	* src/abg-elf-reader.cc (reader::variable_symbol_is_exported): Do
	not crash when the symbol we are looking at is non-present.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master branch.
---
 src/abg-elf-reader.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/src/abg-elf-reader.cc b/src/abg-elf-reader.cc
index 80720716..610f8617 100644
--- a/src/abg-elf-reader.cc
+++ b/src/abg-elf-reader.cc
@@ -874,7 +874,7 @@  elf_symbol_sptr
 reader::variable_symbol_is_exported(const string& name) const
 {
   const elf_symbol_sptr s  = symtab()->variable_symbol_is_exported(name);
-  if (s->is_variable() && s->is_public())
+  if (s && s->is_variable() && s->is_public())
     {
       bool looking_at_linux_kernel_binary =
 	(load_in_linux_kernel_mode()