aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-10 19:30:14 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-24 20:59:12 +0100
commitd5e633fc978bad2266c9b25f55bead7415eb491d (patch)
tree0310b6289204f49fa3363baaf9fc5fbdab91ea43
parentdd680bf3dda1495c5fcb6e71ce3c1b95cf7ac6bb (diff)
object: add extra sanity checks
Type system checked that children class_size >= parent class_size, but not instances. Fix that. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200110153039.1379601-2-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--qom/object.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c
index 90155faec1..dcb686348b 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -307,6 +307,7 @@ static void type_initialize(TypeImpl *ti)
int i;
g_assert(parent->class_size <= ti->class_size);
+ g_assert(parent->instance_size <= ti->instance_size);
memcpy(ti->class, parent->class, parent->class_size);
ti->class->interfaces = NULL;
ti->class->properties = g_hash_table_new_full(