Message ID | 20240311191241.4177990-20-peter.maydell@linaro.org |
---|---|
State | Accepted |
Commit | 98d16e5f724cf4f884cab28956321a4a093474d7 |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1689632wrt; Mon, 11 Mar 2024 12:20:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWmL5EWb9laABqFsQxT9juEF1FkFL1Sp58y2MZRbpMgBe5nII55XYK0IgIawFBAXESZLIEMeFGZQNs6eki7z0BJ X-Google-Smtp-Source: AGHT+IGwDKkFNNW+KX7HHMNnJE6dnUcH27WlVygvN1YHqoO+neQSpk20E7WGqJ94KF9DKCzzaJNq X-Received: by 2002:a05:6808:1189:b0:3c1:9b87:dd90 with SMTP id j9-20020a056808118900b003c19b87dd90mr1726813oil.34.1710184833813; Mon, 11 Mar 2024 12:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184833; cv=none; d=google.com; s=arc-20160816; b=fr5ArRCM4bdP6l4O/Sz5FGRCckQP6IyS46YghXxHPWeHDVVFN6ZYIzW7AOJA4umu8Q 90f/9Ln5U3dz8jq/PSrXQO5dHGTsWJJCbt8OQJb+2mTLKomwVvD6m7v3J8ew/Zd1oRa1 t0gFBRmy5PzylAAYb5JdNVHQZjPyH2AT2xsEZi3wnQqC08bmMSA4vxIjMuxI17be2Zri z9dYHi9GFioRKoaOiCu2xTvHfKVc8iLsxQfzH+jOwkb3phhEGia1JYx1BYZ8rqwpD478 huE9o3pQJOHBteY7eglTqWcmctI+BwsXvTZlwOW0+vpZaBwnMzjXJNOmc6eIJDXvPdRF xK4Q== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yKKx3IOByUMeAMGSYuM0l0stWjxVzOikFpYz9umacLc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Nn6mShvOFHjJ1BnCII/q3ABjQYPsAI+hPMaU7CnR4GVb/AYDs7W9Ym/C/D8IfVwVJT mnk+CNmxU0rOHUct88rQdXmbxpSLEhQlHJOqYfdSgh/1X3tASVxjumW3TYv04vui68Tt 53IZCivQ6y6LUAcu9ENrWAei1MCYfvyQHtjiWrsfEY79WXplVsHRMeCqCzTuSgeT7Y/T m6aitJseKQff47It1ouROE/yyo4fcMiIdBbR/tip2h30cLQgHXx/CgmKKbfsxX+8n56/ 8Eo1LzE9Bg32837/m+10d3grVwmjT0WnYgPbrSGw3XVLRQ58QdxG290uvzSGChS4Liqi DJpw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CKAogRjR; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 4-20020a05621420c400b0068cbcf48e43si6435575qve.49.2024.03.11.12.20.33 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:20:33 -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=CKAogRjR; 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 <qemu-devel-bounces@nongnu.org>) id 1rjl80-0005Yf-PC; Mon, 11 Mar 2024 15:16:05 -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 <peter.maydell@linaro.org>) id 1rjl53-0003PJ-1x for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:03 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>) id 1rjl4x-0000Ns-4n for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:00 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-41331166961so1665875e9.1 for <qemu-devel@nongnu.org>; Mon, 11 Mar 2024 12:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184371; x=1710789171; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yKKx3IOByUMeAMGSYuM0l0stWjxVzOikFpYz9umacLc=; b=CKAogRjR1/zANIGqogF7BS0hCbJyBf51vSWn7kuKGqETKdmwdaAaIhKTgOvge1EK+G ueceZAa0HXc/jF22wtAT9g1KSKFElFtNe3yvMoq6oaScV6t/PPiffERVa9dES03HGVac hlNUgxOC4jJmCuk/umuqf/iE29vLY4MiBkaGBr8Coa04KZlfCzRxc3pbceFFWaVdCwUF K+4hpPhuaDzOElvCxugFzPOVTVn8OHXuOSdEeIjTBrAiueMRhmOLcqR7QJf0w47PaBMa qcxmu7RAgVeuNKiJnSbCe2299lM5rHn9EKGhtkwY8aRMuNMErzQaSgCTjkfaWsIzleJq 0Z4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184371; x=1710789171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yKKx3IOByUMeAMGSYuM0l0stWjxVzOikFpYz9umacLc=; b=NmziGU5Xnh2nqskR/+ctkcuoJ+sIkBSgOfr9OOZfIRB/O8/xdJ7hwIV7bTU4K9kIPO bLUrM8ZW7HotLzR0SxcyBKxAN9HRtxnjImDbzTMgZNBI4cHwuIGnwaQKBk3xiWckxwdH xRdBINIjIsBcVDu6C1Nh90c9VSQm7PFGj81mxt2+2CebxJHGGP2ZWVThO/hoeKaCRpuE fNMH9haECq7zWgZ9DH2HXrGrGzqOPEi72rxv7VdXHDzQL0th/p/j5+XLWAbrBIxnJfgy bsgJ/GZ6JME6LyQQwWStpLtgFIjL676nBlaRdRas7SdU3HScdnduG05vqm83tRuFP5VN Iexg== X-Gm-Message-State: AOJu0YzK4Si4NAdrEO1rejNz+B1eoaKUWbP0tSF9TIlbZuDI7VPRZTkW wdakuTrLLhHxiTkpPAIoTS9Xj4nvO0MVnbScCi7F47nLwDCE+IIkzIOHFmSPrxIFLnxkooXmBBA t X-Received: by 2002:a05:600c:6a1a:b0:413:1285:6e40 with SMTP id jj26-20020a05600c6a1a00b0041312856e40mr5673901wmb.20.1710184371490; Mon, 11 Mar 2024 12:12:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.51 for <qemu-devel@nongnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:51 -0700 (PDT) From: Peter Maydell <peter.maydell@linaro.org> To: qemu-devel@nongnu.org Subject: [PULL 19/20] contrib/elf2dmp: Ensure phdrs fit in file Date: Mon, 11 Mar 2024 19:12:40 +0000 Message-Id: <20240311191241.4177990-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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, T_SCC_BODY_TEXT_LINE=-0.01 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-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
[PULL,01/20] hw/arm: Deprecate various old Arm machine types
|
expand
|
diff --git a/contrib/elf2dmp/qemu_elf.c b/contrib/elf2dmp/qemu_elf.c index 8d750adf904..c9bad6e82cf 100644 --- a/contrib/elf2dmp/qemu_elf.c +++ b/contrib/elf2dmp/qemu_elf.c @@ -132,6 +132,7 @@ static void exit_states(QEMU_Elf *qe) static bool check_ehdr(QEMU_Elf *qe) { Elf64_Ehdr *ehdr = qe->map; + uint64_t phendoff; if (sizeof(Elf64_Ehdr) > qe->size) { eprintf("Invalid input dump file size\n"); @@ -173,6 +174,13 @@ static bool check_ehdr(QEMU_Elf *qe) return false; } + if (umul64_overflow(ehdr->e_phnum, sizeof(Elf64_Phdr), &phendoff) || + uadd64_overflow(phendoff, ehdr->e_phoff, &phendoff) || + phendoff > qe->size) { + eprintf("phdrs do not fit in file\n"); + return false; + } + return true; }