diff options
author | Markus Trippelsdorf <markus@trippelsdorf.de> | 2017-11-27 12:53:16 +0000 |
---|---|---|
committer | Markus Trippelsdorf <trippels@gcc.gnu.org> | 2017-11-27 12:53:16 +0000 |
commit | 04f915037850166c05c73baf3d6e2ba10c790ea1 (patch) | |
tree | 703d423fa1f611f0b40c39291c259f3f9c44229d /gcc/hash-map.h | |
parent | ff27462edc398ca82e86c8c7f13d9fab498ba5c1 (diff) | |
download | gcc-04f915037850166c05c73baf3d6e2ba10c790ea1.zip gcc-04f915037850166c05c73baf3d6e2ba10c790ea1.tar.gz gcc-04f915037850166c05c73baf3d6e2ba10c790ea1.tar.bz2 |
Fix UB in hash-map.h
bootstrap-ubsan shows:
gcc/hash-map.h:277:19: runtime error: member access within null pointer of type 'struct hash_map'
Fix the issue by returning early.
From-SVN: r255166
Diffstat (limited to 'gcc/hash-map.h')
-rw-r--r-- | gcc/hash-map.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/hash-map.h b/gcc/hash-map.h index 6b8365a9d..10ae52d 100644 --- a/gcc/hash-map.h +++ b/gcc/hash-map.h @@ -274,7 +274,8 @@ template<typename K, typename V, typename H> static inline void gt_cleare_cache (hash_map<K, V, H> *h) { - gt_cleare_cache (&h->m_table); + if (h) + gt_cleare_cache (&h->m_table); } template<typename K, typename V, typename H> |