public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-9939] libstdc++: Fix null dereference in pb_ds containers
@ 2021-06-18 12:56 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-06-18 12:56 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:94712f96ec4be85d3dbdb3647c64268227519987
commit r10-9939-g94712f96ec4be85d3dbdb3647c64268227519987
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue May 4 15:46:28 2021 +0100
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.
(cherry picked from commit ca871701c2822c3c4537745d4aa44a7b8f408337)
Diff:
---
.../pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp | 26 +++++++++++++---------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
index a46b23f4699..3787526a3a7 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
@@ -524,13 +524,16 @@ namespace __gnu_pbds
resize_base::notify_find_search_end();
-#ifdef _GLIBCXX_DEBUG
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
- PB_DS_CHECK_KEY_EXISTS(r_key)
-#endif
- return &p_e->m_value;
+ {
+ PB_DS_CHECK_KEY_EXISTS(r_key)
+ return &p_e->m_value;
+ }
}
inline pointer
@@ -550,13 +553,16 @@ namespace __gnu_pbds
resize_base::notify_find_search_end();
-#ifdef _GLIBCXX_DEBUG
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
- PB_DS_CHECK_KEY_EXISTS(r_key)
-#endif
- return &p_e->m_value;
+ {
+ PB_DS_CHECK_KEY_EXISTS(r_key)
+ return &p_e->m_value;
+ }
}
inline bool
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-18 12:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 12:56 [gcc r10-9939] libstdc++: Fix null dereference in pb_ds containers Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).