Message ID | 20200401094759.5835-2-alex.bennee@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp328703ilr; Wed, 1 Apr 2020 02:48:18 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs+OmhpcaOG5ocZ3TI/ws6b+BfCbOvDWfQOz13iAcopIRkgopHKQt1HOFKs+IEXcV6uchDn X-Received: by 2002:a05:620a:1405:: with SMTP id d5mr9235168qkj.275.1585734498262; Wed, 01 Apr 2020 02:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585734498; cv=none; d=google.com; s=arc-20160816; b=TLlcIgowlB0FZaIVW6InYtO2eNqyl1VsVYvpYybxHrleATn2Z/GY7UbgjTot/xw+uT pSdBmzAlX4iCB4bvfKjo06ymunTUrn3KsgGgFyNcPFbmjrW4BaqwuIrUFAaPCgEQhV4Q pQ3tx6TpnAN5kORuPSBBwNqW4Ey0TaWDBRRvaUFJFy6Q3IowXJlqcErzwwl1px55I8Le GdyehNBX9h/hKJjaP+6kyyIh2zN9J6Y7bDIU/rBdDbvHm+qHlt44SfzLoQ0XDaoXfHUM zX6/95pxOBGqAYarsg0fm2LwVnsEx5LTA3WkGObzPFBr2+bLSdc1Y3bappHArQzzSH+D 7/Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=dAKPurE9Z4/yGpaiKXNSiApWEbrm/XJIzako9b36VuI=; b=BT9QlXqd/Ols+RjrO+TuF38h0uck6qYKduvuxT5YDk1H9dpDI68zCpc1vczBeOMuyM nZzeJDszsYWG+SEr0uUEXcfWO9nRAWYot9YYEmnDpDn++6TdkrPAMIMEqfCt1qiQx0Av XfGL8RJku1LbEsQfR/O3rF+Uu5R0xy/IK6RLtX+iGP16a9sKmQPsV0aJ/UZB9LMPAmOO pXqB2RsKkHGqV54XPi4Kj98syah0rNNP6/Hmwo3eoSUl8U3/qgEH/0bxgLY6IJRQ5fpC ytfkb+cDFVU4UwXPSFCta4aahj42B8S9JB2P++jFBhR4g8W4oShEmWWAc3w2axE9O5IQ DgDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LVtRNlmk; 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=fail (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 bq5si759127qvb.48.2020.04.01.02.48.18 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Apr 2020 02:48:18 -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=fail header.i=@linaro.org header.s=google header.b=LVtRNlmk; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1jJZyr-0004BY-OB for patch@linaro.org; Wed, 01 Apr 2020 05:48:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38387) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>) id 1jJZyf-0004BJ-BF for qemu-devel@nongnu.org; Wed, 01 Apr 2020 05:48:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <alex.bennee@linaro.org>) id 1jJZye-000296-Ep for qemu-devel@nongnu.org; Wed, 01 Apr 2020 05:48:05 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:45978) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <alex.bennee@linaro.org>) id 1jJZye-00028a-9G for qemu-devel@nongnu.org; Wed, 01 Apr 2020 05:48:04 -0400 Received: by mail-wr1-x444.google.com with SMTP id t7so29716404wrw.12 for <qemu-devel@nongnu.org>; Wed, 01 Apr 2020 02:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dAKPurE9Z4/yGpaiKXNSiApWEbrm/XJIzako9b36VuI=; b=LVtRNlmkf0SEwI6n3XILfZ5dEar6Zo/Wcgi6qnaCoi1I15MiGFbqSvCHsrv9PS3i1o ZMiAD67aotCYrzK/mZo5ttz70YvCuuDsocbEYl8SaXnBiDacY4z1kIdbGfhJF2Oud3U/ bNDIBt+ThGflldG5q3jWmGwCUq87h2Fg3D3wtQtE2RQdNfCPFSMcSXQkJulzKRT51EZu 31JXdpj+q/zsaPQbi1wlJOzgtB5hRwAdwaCf4ml64J0VSeTS8ARVn7qqrz5txk8zcPx6 1WW0NLaBO55JlFCDwJzC0C56/qfyc49QPJ+E65a3cXu8xA5TuaEj7KniqwPuxZuCoIt+ cFZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dAKPurE9Z4/yGpaiKXNSiApWEbrm/XJIzako9b36VuI=; b=Ct8B7oAoujH9cFYFZdan5M8QYLOVhX6/xaEE1expbTL7xEOHGY3R775T1nXDY8cutE HzzffU2TEuxhSOVYXvN6dtw/fbbCdPiwF0x25Hbh772DIEDMAWkA87POjf+Wc6WEpluN qGshfYffhTsP3gHdbEH5GrX/JDeLDTaP3MxWSbwZWtCh4kCND9lx/UFUgj4HzEXGskt6 +dH+XgoPtrLK1aLvQWXdmLjAdM+7JrynCCoiYMf3vxy8mPkOz6CKuLDGShHDyqMac+84 tioFYHBnGrj9jTQ9Uk/BdI+q0b4gCSGULso6+Lj//78M1f69n+L5KecvFzuePLaNBwUM M6Bw== X-Gm-Message-State: ANhLgQ3MrymAgA8LVTrmdbKZWeZkZ5/DEOlLhqZ2QksHMW25gA5oarvG fPCLUUqZo+novFi9resu+whQyg== X-Received: by 2002:adf:b6a5:: with SMTP id j37mr25065764wre.412.1585734483166; Wed, 01 Apr 2020 02:48:03 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 9sm1926646wmm.6.2020.04.01.02.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 02:48:00 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E86F91FF87; Wed, 1 Apr 2020 10:47:59 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org> To: qemu-devel@nongnu.org Subject: [PATCH v2 01/10] elf-ops: bail out if we have no function symbols Date: Wed, 1 Apr 2020 10:47:50 +0100 Message-Id: <20200401094759.5835-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200401094759.5835-1-alex.bennee@linaro.org> References: <20200401094759.5835-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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> Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= <alex.bennee@linaro.org> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
A selection of sanitiser fixes
|
expand
|
diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index a1411bfcab6..b5d4074d1e3 100644 --- a/include/hw/elf_ops.h +++ b/include/hw/elf_ops.h @@ -170,8 +170,13 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab, } i++; } - syms = g_realloc(syms, nsyms * sizeof(*syms)); + /* check we have symbols left */ + if (nsyms == 0) { + goto fail; + } + + syms = g_realloc(syms, nsyms * sizeof(*syms)); qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ)); for (i = 0; i < nsyms - 1; i++) { if (syms[i].st_size == 0) {