From patchwork Sat Jun 15 12:33:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 251624 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A86382C0096 for ; Sat, 15 Jun 2013 22:34:22 +1000 (EST) Received: from localhost ([::1]:49252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnpgR-0003F4-Ch for incoming@patchwork.ozlabs.org; Sat, 15 Jun 2013 08:34:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnpgA-0003Ex-7i for qemu-devel@nongnu.org; Sat, 15 Jun 2013 08:34:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Unpg7-0004FT-OC for qemu-devel@nongnu.org; Sat, 15 Jun 2013 08:34:02 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:39264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Unpg7-0004F9-I5 for qemu-devel@nongnu.org; Sat, 15 Jun 2013 08:33:59 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3bXdQs1xxqz4KK4B for ; Sat, 15 Jun 2013 14:33:57 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3bXdQs0q3tzbbhK for ; Sat, 15 Jun 2013 14:33:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id KCSs4gEy9vBp for ; Sat, 15 Jun 2013 14:33:55 +0200 (CEST) X-Auth-Info: daROJ6bzxJtZI3/u6TzxcVSHiruIrl55NYqxIYzyGSk= Received: from igel.home (ppp-88-217-112-59.dynamic.mnet-online.de [88.217.112.59]) by mail.mnet-online.de (Postfix) with ESMTPA for ; Sat, 15 Jun 2013 14:33:55 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 9F232E41BD; Sat, 15 Jun 2013 14:33:55 +0200 (CEST) From: Andreas Schwab To: qemu-devel@nongnu.org X-Yow: I feel like a wet parking meter on Darvon! Date: Sat, 15 Jun 2013 14:33:55 +0200 Message-ID: <878v2b8sek.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 212.18.0.9 Subject: [Qemu-devel] [PATCH] linux-user: fix signal number range check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When translating between host and target signal numbers keep negative numbers unchanged, avoiding access beyond array bounds. Signed-off-by: Andreas Schwab Reviewed-by: Peter Maydell --- linux-user/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 5da8452..c4d8970 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -102,14 +102,14 @@ static inline int sas_ss_flags(unsigned long sp) int host_to_target_signal(int sig) { - if (sig >= _NSIG) + if (sig < 0 || sig >= _NSIG) return sig; return host_to_target_signal_table[sig]; } int target_to_host_signal(int sig) { - if (sig >= _NSIG) + if (sig < 0 || sig >= _NSIG) return sig; return target_to_host_signal_table[sig]; }