diff options
author | Lukas Oberhuber <lukaso@gmail.com> | 2022-01-11 23:01:08 +0000 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2022-01-12 05:43:00 +0000 |
commit | c2579c71222c181068b5aaf795aa0f1e8909d89e (patch) | |
tree | 6613257bc895ee7955624c1a87f8acbb7a2f3738 /girepository | |
parent | 3dd0b22c4ecf69689575d24d28ac9a1afa020b53 (diff) | |
download | gobject-introspection-c2579c71222c181068b5aaf795aa0f1e8909d89e.tar.gz |
girepository: avoids segfault in case of bad gtype
If a <GType invalid> (that's the way it appears in python's debugger) is
returned, `g_type_name` returns NULL. This
function therefore returns NULL at this time
as subsequent calls to `strlen( data->gtype_name)` segfault.
Diffstat (limited to 'girepository')
-rw-r--r-- | girepository/girepository.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/girepository/girepository.c b/girepository/girepository.c index 7d034859..d7f6ceb4 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -806,12 +806,14 @@ find_by_gtype (GHashTable *table, FindByGTypeData *data, gboolean check_prefix) */ GIBaseInfo * g_irepository_find_by_gtype (GIRepository *repository, - GType gtype) + GType gtype) { FindByGTypeData data; GIBaseInfo *cached; DirEntry *entry; + g_return_val_if_fail (gtype != G_TYPE_INVALID, NULL); + repository = get_repository (repository); cached = g_hash_table_lookup (repository->priv->info_by_gtype, |