From 544af9942e57b5262fed1a5c30ee108aeb747d08 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 3 Dec 2001 17:45:34 +0000 Subject: [PATCH] added a few asserts to make sure we don't mess up if IDs go above 16bit git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2183 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/perl/perl-common.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c index a8e163e9..4187ae84 100644 --- a/src/perl/perl-common.c +++ b/src/perl/perl-common.c @@ -79,6 +79,9 @@ SV *irssi_bless_iobject(int type, int chat_type, void *object) PERL_OBJECT_REC *rec; HV *stash, *hv; + g_return_val_if_fail((type & ~0xffff) == 0, NULL); + g_return_val_if_fail((chat_type & ~0xffff) == 0, NULL); + rec = g_hash_table_lookup(iobject_stashes, GINT_TO_POINTER(type | (chat_type << 16))); if (rec == NULL) { @@ -144,6 +147,9 @@ void irssi_add_object(int type, int chat_type, const char *stash, PERL_OBJECT_REC *rec; void *hash; + g_return_if_fail((type & ~0xffff) == 0); + g_return_if_fail((chat_type & ~0xffff) == 0); + hash = GINT_TO_POINTER(type | (chat_type << 16)); rec = g_hash_table_lookup(iobject_stashes, hash); if (rec == NULL) {