From 08324547dad7515e38df8d026f62f30fbc72675b Mon Sep 17 00:00:00 2001 From: reuk Date: Wed, 11 Oct 2017 17:51:01 +0100 Subject: [PATCH] Fix a couple of places where a null pointer may be dereferenced --- src/goto-programs/remove_exceptions.cpp | 4 ++-- src/java_bytecode/java_bytecode_typecheck_expr.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/goto-programs/remove_exceptions.cpp b/src/goto-programs/remove_exceptions.cpp index a49dcb12a4e..035851beb52 100644 --- a/src/goto-programs/remove_exceptions.cpp +++ b/src/goto-programs/remove_exceptions.cpp @@ -312,7 +312,7 @@ void remove_exceptionst::add_exception_dispatch_sequence( // find the symbol corresponding to the caught exceptions const symbolt &exc_symbol= - *symbol_table.lookup(id2string(function_id)+EXC_SUFFIX); + symbol_table.lookup_ref(id2string(function_id)+EXC_SUFFIX); symbol_exprt exc_thrown=exc_symbol.symbol_expr(); // add GOTOs implementing the dynamic dispatch of the @@ -387,7 +387,7 @@ void remove_exceptionst::instrument_throw( // find the symbol where the thrown exception should be stored: const symbolt &exc_symbol= - *symbol_table.lookup(id2string(func_it->first)+EXC_SUFFIX); + symbol_table.lookup_ref(id2string(func_it->first)+EXC_SUFFIX); symbol_exprt exc_thrown=exc_symbol.symbol_expr(); // add the assignment with the appropriate cast diff --git a/src/java_bytecode/java_bytecode_typecheck_expr.cpp b/src/java_bytecode/java_bytecode_typecheck_expr.cpp index d73525ccc60..e5b4d0fe572 100644 --- a/src/java_bytecode/java_bytecode_typecheck_expr.cpp +++ b/src/java_bytecode/java_bytecode_typecheck_expr.cpp @@ -290,8 +290,8 @@ void java_bytecode_typecheckt::typecheck_expr_member(member_exprt &expr) { // member doesn't exist. In this case struct_type should be an opaque // stub, and we'll add the member to it. - symbolt &symbol_table_type= - *symbol_table.get_writeable("java::"+id2string(struct_type.get_tag())); + symbolt &symbol_table_type=symbol_table.get_writeable_ref( + "java::"+id2string(struct_type.get_tag())); auto &add_to_components= to_struct_type(symbol_table_type.type).components(); add_to_components