mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-14 22:14:35 +00:00
Fix --type-id-style hash for empty internal names.
libabigail's intern_string class treats the empty string specially. It is not safe to call the raw method without checking for a empty pointer. It is safe to convert to std::string. This commit changes the XML writer to convert interned strings to std::strings before computing their hashes. * src/abg-writer.cc (write_context::get_id_for_type): When hashing internal type names, convert to std::string rather than using the raw method directly as this will avoid a null pointer dereference in the case of an empty string; tabify code indentation. Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
96ce0785fd
commit
be0effa6fd
@ -457,7 +457,7 @@ public:
|
||||
case HASH_TYPE_ID_STYLE:
|
||||
{
|
||||
interned_string pretty = c->get_cached_pretty_representation(true);
|
||||
size_t hash = hashing::fnv_hash(*pretty.raw());
|
||||
size_t hash = hashing::fnv_hash(pretty);
|
||||
while (!m_used_type_id_hashes.insert(hash).second)
|
||||
++hash;
|
||||
std::ostringstream os;
|
||||
|
Loading…
Reference in New Issue
Block a user