Skip to content
Snippets Groups Projects
Commit ca871701 authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

libstdc++: Fix null dereference in pb_ds containers

This fixes ubsan errors:

ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp:533:15: runtime error: member access within null pointer of type 'struct entry'

libstdc++-v3/ChangeLog:

	* include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
	(find_key_pointer(key_const_reference, false_type))
	(find_key_pointer(key_const_reference, true_type)): Do not
	dereference null pointer.
parent 6fb8b670
No related branches found
No related tags found
No related merge requests found
...@@ -524,13 +524,16 @@ namespace __gnu_pbds ...@@ -524,13 +524,16 @@ namespace __gnu_pbds
resize_base::notify_find_search_end(); resize_base::notify_find_search_end();
#ifdef _GLIBCXX_DEBUG
if (p_e == 0) if (p_e == 0)
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) {
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return 0;
}
else else
PB_DS_CHECK_KEY_EXISTS(r_key) {
#endif PB_DS_CHECK_KEY_EXISTS(r_key)
return &p_e->m_value; return &p_e->m_value;
}
} }
inline pointer inline pointer
...@@ -550,13 +553,16 @@ namespace __gnu_pbds ...@@ -550,13 +553,16 @@ namespace __gnu_pbds
resize_base::notify_find_search_end(); resize_base::notify_find_search_end();
#ifdef _GLIBCXX_DEBUG
if (p_e == 0) if (p_e == 0)
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key) {
PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
return 0;
}
else else
PB_DS_CHECK_KEY_EXISTS(r_key) {
#endif PB_DS_CHECK_KEY_EXISTS(r_key)
return &p_e->m_value; return &p_e->m_value;
}
} }
inline bool inline bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment