Skip to content

Commit

Permalink
Fix UB when downcasting null pointers, use pointer_trait' specialized…
Browse files Browse the repository at this point in the history
… function
  • Loading branch information
igaztanaga committed May 2, 2023
1 parent f11301c commit fc46064
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/boost/intrusive/hashtable.hpp
Expand Up @@ -591,7 +591,7 @@ inline typename pointer_traits<SlistNodePtr>::template rebind_pointer<Node>::typ
dcast_bucket_ptr(const SlistNodePtr &p)
{
typedef typename pointer_traits<SlistNodePtr>::template rebind_pointer<Node>::type node_ptr;
return pointer_traits<node_ptr>::pointer_to(static_cast<Node&>(*p));
return pointer_traits<node_ptr>::static_cast_from(p);
}

template<class NodeTraits>
Expand Down

0 comments on commit fc46064

Please sign in to comment.