From patchwork Fri Aug 18 15:10:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 714634 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp558729wrs; Fri, 18 Aug 2023 08:11:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFApJDkQ8nBkpGP8bEkPE9fcZF3ozmD+OGWJy7zMmkqF1fI4Kipf5SpJUF+aC+y001gVc5 X-Received: by 2002:a05:622a:1aa4:b0:405:5346:9934 with SMTP id s36-20020a05622a1aa400b0040553469934mr3439506qtc.48.1692371490997; Fri, 18 Aug 2023 08:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692371490; cv=none; d=google.com; s=arc-20160816; b=TFWnkNl7NtfY2DP0K0jkkfeA6K0QQfhB8B6XOapBp68crWK8T8q2R7t+e9TboryK+N TPmgaWLf5o+0a25UpjuAmnnCs4ySaKIbLaz5Q4v+F5/WwpbxgWMfQckPvtewJSntJPT5 ChIIQ4VhQSKAUzPu94WqGvEKtj+aiaTTmK0wUw0jJPvGnDsSGfU3blhMbd0YTgt4+tZL IYauCIt2KSmejUBHM3xK7wQYHZCYCdSne69nAnt0mjnmWrjhpIUDlNfHSSFAneyFFCKo 2EfW6ZkXAR9T+b3IuPaTWBpTVAy6RhS/OfOQxlZNJNo5HC6WJFpti1aYLRtL5QQB6yOr G5lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=/O6++0QHUEhAPLM7jGuNogMD5mILdjSlpdhFG+dOiM0=; fh=fclF8Ddo4kJBfUi2yI/ShRR06Z4BeLmUEP51LT7dsNI=; b=GDWFqkhMHeNrGuHVJMvNE/MwneTe4WjkVMxUjrXo37h1FT2XsNHAAnuv+36jm3iMSg PNphsrQYVGulQQWp3XoqG55n8IRutzb+90uBCRF8CBUzEibGqUQx6FmCnk8dN6gmfHqH g9Or8BaQ67EE5v4srKqLzgl0STjlCE6WgETmpjCn+LoyDiwt6duMl2inK6sIjLWPsvGq SmB9z0ZFeqhesRIB07Ais/+KVhLIHc4fQnaf0RpO3f+3AS86HCZ1yPQX6PywWpDVhx/C eonns1lGDNPxZpCaafzJPdcceDA+K3bbDOzfEJvMOvsEns+6xm2UgdHgKiG3JTrs7oqj wuQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="E+yxl/WE"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j16-20020ac806d0000000b004039d9d86c2si1214830qth.107.2023.08.18.08.11.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Aug 2023 08:11:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="E+yxl/WE"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX17w-0006D1-Mx; Fri, 18 Aug 2023 11:11:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qX17u-0006CB-Qp for qemu-devel@nongnu.org; Fri, 18 Aug 2023 11:11:02 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX17s-0007Ys-GZ for qemu-devel@nongnu.org; Fri, 18 Aug 2023 11:11:02 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fe2048c910so10052245e9.1 for ; Fri, 18 Aug 2023 08:11:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692371459; x=1692976259; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/O6++0QHUEhAPLM7jGuNogMD5mILdjSlpdhFG+dOiM0=; b=E+yxl/WEQEnq9mR8T+9WdCRQvriSTAJDw1HqarhHhXKQ7wFszJJ6gPAE2hkYj619Vd 8rn0bW/ndOeoUVM7Fb1lAOyRnVmTZqafujtXzIpiSzBqI9nELeE5r5zDKGnPwh1MiARp oPxkxVW4DmXF9mF7RVW+EwkFIBUsDlkfeQc6md7sPDKjKRPu9rjPtNtiL4SsyPIirTR3 7Lkha/QgIaIEr1Q1jztxniArxdQbkgLwjMBRKF7Jk1m6KOlYFyIjUZXKfA8JRaONLgS/ SpgXsw6rOOSAlwnSh9l0W6DOLsqWjTeYj/Qw0lHRMjwhuEPoV1J2/8xEkbEsNPxyQlP/ B7KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692371459; x=1692976259; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/O6++0QHUEhAPLM7jGuNogMD5mILdjSlpdhFG+dOiM0=; b=hYFb+RpdPOYgnRkUGe/ul2+ER0LHvx7UYz0lTERgSqsEDag9omf3oFC1yIkVZ62zZG KFzdwFiQhuReLPvXpZb+bVmRoSfybn0wAhdCgUNyIxE04rotIP8n2rXuzKTq7HgKyJzC aOYwuB1UAbQ/3U25MW/QNgOP6hH+rT3jb77j6wo1Vk/fziMY4q7zVZdt0DT/M8ZM5IUj YIazputKjZxzo6n0EM4cp7rwPiPOaJooyqBidH2EB+BtKj4FsauaV9FTXr+zAPUzj7Fd YJk8qcr/PkE+3RwrLPPb3TRDQXUUQnOvhU+c65LbJDFBWZ1PHL55XnHq0wK3UqmjJPmH dSSw== X-Gm-Message-State: AOJu0Yw+4rx4rlA2/EFCxQuS7WazzwF6j+jka76L0fdWDSmu/cOr8ADD 7c/qEkw5cmNFjTPHvvLgE01RtmVzq5oXYLyGVPk= X-Received: by 2002:adf:fdd2:0:b0:31a:d31:dbf9 with SMTP id i18-20020adffdd2000000b0031a0d31dbf9mr2158607wrs.49.1692371458923; Fri, 18 Aug 2023 08:10:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id a26-20020a5d457a000000b00316eb7770b8sm3097631wrc.5.2023.08.18.08.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Aug 2023 08:10:58 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 0/3] ui: avoid dynamic stack allocations Date: Fri, 18 Aug 2023 16:10:54 +0100 Message-Id: <20230818151057.1541189-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The codebase has very few VLAs, and if we can get rid of them all we can make the compiler error on new additions. This is a defensive measure against security bugs where an on-stack dynamic allocation isn't correctly size-checked (e.g. CVE-2021-3527). This patchset fixes some places in the spice and vnc UI frontends that were doing on-stack allocations. For the vnc-enc-hextile case we can make the array fixed size; for the other two places we switch to a heap allocation. Disclaimer: tested only with compile + make check, which doesn't actually exercise the UI frontends. thanks -- PMM Peter Maydell (2): ui/spice-display: Avoid dynamic stack allocation ui/vnc-enc-hextile: Use static rather than dynamic length stack array Philippe Mathieu-Daudé (1): ui/vnc-enc-tight: Avoid dynamic stack allocation ui/vnc-enc-hextile-template.h | 8 +++++++- ui/spice-display.c | 3 ++- ui/vnc-enc-tight.c | 11 ++++++----- 3 files changed, 15 insertions(+), 7 deletions(-)