From nobody Sat May 30 18:38:28 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1777792241; cv=none; d=zohomail.com; s=zohoarc; b=SlypjJ1QlSFCzx3FllBFF+C+swuSOMBX4xJ32QJnYXF55+EGnjn/azzi68nkvw5MJlvLfyPBSRklGzuWscDlaisDkPEpPkOhac90MSnHyvg2gMYHT+guPsVkmvu/I8qj+a39mFelcNBWcSVgBiJPE8KL4lkTFM25N4DFg9LKW2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777792241; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dWdls0qxO24t0lHRZtq5+1onptUNMWa3UAZJKRMBIhc=; b=kBVvKpX8jCjhE3inosVZ+pxCf9rJog9E03ElHhFEhipWrKbfPzaRdWjcswJKL623fz9ETfmRMY03vPHqJZ2qZIju5FFE2NZa8s5mCM8WlM/fgBgjumxtLSJ0VMf9WuLReK+qf/eGTjr5jvCpxBubGtACdWfIITAlQ6AW1ALEHuM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177779224151099.25152605656456; Sun, 3 May 2026 00:10:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wJQxi-0005ee-2N; Sun, 03 May 2026 03:09:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wJQxf-0005eW-Su for qemu-devel@nongnu.org; Sun, 03 May 2026 03:09:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wJQxe-0002BO-3I for qemu-devel@nongnu.org; Sun, 03 May 2026 03:09:55 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-AkUG29rgNby310tzq_M3Nw-1; Sun, 03 May 2026 03:09:48 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EB0E51800473 for ; Sun, 3 May 2026 07:09:47 +0000 (UTC) Received: from localhost (unknown [10.44.24.4]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BEE9619560A6; Sun, 3 May 2026 07:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777792190; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dWdls0qxO24t0lHRZtq5+1onptUNMWa3UAZJKRMBIhc=; b=KPHohrbp6cdKXTvXA2qB9AASihnt9QMdLQsRMMrbbGZXf1gqX6p7VeMwBAHJyYbrs1POK+ FoAKnKHtqliwuqQdXl7VHz8ERSSTxWZe+pj14UK2L9OCZGjOD704D0Pjjud/v0flkA4f3e NveW90xgq6IkL66wv6UBiABgooKGVmU= X-MC-Unique: AkUG29rgNby310tzq_M3Nw-1 X-Mimecast-MFC-AGG-ID: AkUG29rgNby310tzq_M3Nw_1777792188 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH] ui/input: do not assert() when tracing invalid input Date: Sun, 3 May 2026 11:09:39 +0400 Message-ID: <20260503070939.2730826-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1777792245511158500 From: Marc-Andr=C3=A9 Lureau It's possible to reach an assert() in the input tracing code by sending some out of range input values via D-Bus for ex: #0 0x00007fec8652186c in __pthread_kill_implementation () at /lib64/libc= .so.6 #1 0x00007fec864c648e in raise () at /lib64/libc.so.6 #2 0x00007fec864ad7b3 in abort () at /lib64/libc.so.6 #3 0x00007fec864ae804 in __libc_message_impl.cold () at /lib64/libc.so.6 #4 0x00007fec864be345 in __assert_fail () at /lib64/libc.so.6 #5 0x00005597964c551e in qapi_enum_lookup[cold] () #6 0x000055979650514a in qemu_input_event_send_impl () #7 0x0000559796505a4d in qemu_input_queue_btn () #8 0x00007fec85780c19 in dbus_mouse_press () at /usr/bin/../lib64/qemu/u= i-dbus.so #9 0x00007fec857912fc in _g_dbus_codegen_marshal_BOOLEAN__OBJECT_UINT.pa= rt.0 () at /usr/bin/../lib64/qemu/ui-dbus.so #10 0x00007fec874cce7c in g_closure_invoke () at /lib64/libgobject-2.0.so= .0 #11 0x00007fec874eb849 in signal_emit_unlocked_R.isra.0 () at /lib64/libg= object-2.0.so.0 #12 0x00007fec874ec66f in g_signal_emitv () at /lib64/libgobject-2.0.so.0 #13 0x00007fec85797e0a in _qemu_dbus_display1_mouse_skeleton_handle_metho= d_call () at /usr/bin/../lib64/qemu/ui-dbus.so Other paths in input code accept out-of-range values (qemu_input_key_value_to_number etc). Let it pass tracing. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/input.c b/ui/input.c index 57e7817878a..966023d4f4d 100644 --- a/ui/input.c +++ b/ui/input.c @@ -207,22 +207,22 @@ static void qemu_input_event_trace(QemuConsole *src, = InputEvent *evt) break; case INPUT_EVENT_KIND_BTN: btn =3D evt->u.btn.data; - name =3D InputButton_str(btn->button); + name =3D btn->button < INPUT_BUTTON__MAX ? InputButton_str(btn->bu= tton) : "invalid"; trace_input_event_btn(idx, name, btn->down); break; case INPUT_EVENT_KIND_REL: move =3D evt->u.rel.data; - name =3D InputAxis_str(move->axis); + name =3D move->axis < INPUT_AXIS__MAX ? InputAxis_str(move->axis) = : "invalid"; trace_input_event_rel(idx, name, move->value); break; case INPUT_EVENT_KIND_ABS: move =3D evt->u.abs.data; - name =3D InputAxis_str(move->axis); + name =3D move->axis < INPUT_AXIS__MAX ? InputAxis_str(move->axis) = : "invalid"; trace_input_event_abs(idx, name, move->value); break; case INPUT_EVENT_KIND_MTT: mtt =3D evt->u.mtt.data; - name =3D InputAxis_str(mtt->axis); + name =3D mtt->axis < INPUT_AXIS__MAX ? InputAxis_str(mtt->axis) : = "invalid"; trace_input_event_mtt(idx, name, mtt->value); break; case INPUT_EVENT_KIND__MAX: --=20 2.54.0