From ee86a6c05812e504aea959378bff005319d12da3 Mon Sep 17 00:00:00 2001 From: Jason Hiser <jdh8d@virginia.edu> Date: Tue, 25 Dec 2018 05:16:04 -0800 Subject: [PATCH] fixed null ptr deref introduced in prevoius version --- src/zipr.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/zipr.cpp b/src/zipr.cpp index 75cdd8e51..4ad14c2ae 100644 --- a/src/zipr.cpp +++ b/src/zipr.cpp @@ -913,11 +913,12 @@ void ZiprImpl_t::PlaceDollops() * TODO: Consider that allowed_coalescing may invalidate the * possibility of the validity of the placement in (2). */ - const auto ibta=to_place->FallthroughDollop()-> front()-> Instruction()-> GetIndirectBranchTargetAddress() ; - initial_placement_abuts_pin = to_place->FallthroughDollop() && - ibta && - ibta -> GetVirtualOffset()!=0 && - ibta-> GetVirtualOffset() == (placement.GetStart() + to_place->GetSize() - sizer->TRAMPOLINE_SIZE); + const auto has_fallthrough = to_place->FallthroughDollop() != nullptr; + const auto ibta=has_fallthrough ? to_place->FallthroughDollop()-> front()-> Instruction()-> GetIndirectBranchTargetAddress() : 0; + initial_placement_abuts_pin = has_fallthrough && + ibta && + ibta -> GetVirtualOffset()!=0 && + ibta-> GetVirtualOffset() == (placement.GetStart() + to_place->GetSize() - sizer->TRAMPOLINE_SIZE); /* * If this dollop has a fallthrough, find out where that * fallthrough is (or is going to be) placed. That way -- GitLab