From patchwork Tue Jan 24 09:34:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 9534687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DF7DD60434 for ; Tue, 24 Jan 2017 09:46:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D35C322638 for ; Tue, 24 Jan 2017 09:46:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5D0B269E2; Tue, 24 Jan 2017 09:46:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A00B22638 for ; Tue, 24 Jan 2017 09:46:18 +0000 (UTC) Received: from localhost ([::1]:47213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVxg9-0002ux-Ob for patchwork-qemu-devel@patchwork.kernel.org; Tue, 24 Jan 2017 04:46:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVxUh-0001N1-8G for qemu-devel@nongnu.org; Tue, 24 Jan 2017 04:34:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVxUc-0007TX-8S for qemu-devel@nongnu.org; Tue, 24 Jan 2017 04:34:27 -0500 Received: from mail-io0-x241.google.com ([2607:f8b0:4001:c06::241]:33092) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cVxUc-0007T6-3i for qemu-devel@nongnu.org; Tue, 24 Jan 2017 04:34:22 -0500 Received: by mail-io0-x241.google.com with SMTP id 101so9672565iom.0 for ; Tue, 24 Jan 2017 01:34:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:from:to:cc:subject:date; bh=qggX0GpmeGhwiJqcBDTBUntJSB3BEsfOtEmufJs5b18=; b=m1rlr/KW08jQ1w1NgQH1PlIptgRURgdiolQmZAbo2Wid21lA7oPa5mMn1q8AeKUXrw QUgSkNbJHcYIYax5hv8RjDZwId7rvbwFTojzv6Uaji1TE38dwhVffla18I4Vim/S9Qcg UJR025WpEaOgP0fpHjF8YL/WxXlvYycC2xlrAQJF9b7C0bgcgFmQMdznUVJPoWG3OURo 4w8CmXF4oRnKN/Qq3eXy2HVbvpCSjMJP0zU4D1Q8R3SCnDChEW9gg23dRLzUoQlGvque y02knL38q0fwybxxHQC2MAJ3WY4aluOrRzqaraN4xwpkY+rnB0k2HVOXL9P3xSOyxbfw V5UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=qggX0GpmeGhwiJqcBDTBUntJSB3BEsfOtEmufJs5b18=; b=GWZQicDeQrN6qSvchLmHAiZV8h/tJOA6OYthKYcnem+D3ojLO4Yi0sfMnbdPOGsWC1 ccAOhPHaXHIgInP1nX4idW9bMXvi67D+4DS1ekMJruA6d5amgZPaU8U735F0tLbChP6/ S1RWySKSdCzmAgezU3+Sx5K7waaNYziuktjXawo/tmR5UumOB15/EVDWFTkVZkrilXMd tFSVqhloCWvbBPToMi824ERENYOi70jc45nYkV0y7c/5a1sU1ecLWmB8i75HNWMrTu9S mT1CbY6K+1QA/kVmHrXB7UD/YC+IXqKac1CX6vSp8JQ4BimzCj9t+sGYEgIRtB9hXKzE P0xQ== X-Gm-Message-State: AIkVDXK7dm+IxjgbUaOebR2EM5D6vVw/72xtpJBYQf1gAjv962llRVzd8QzSqpNapkeH1A== X-Received: by 10.107.158.143 with SMTP id h137mr26425883ioe.43.1485250459870; Tue, 24 Jan 2017 01:34:19 -0800 (PST) Received: from localhost.localdomain.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id k205sm8013794ita.15.2017.01.24.01.34.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 01:34:19 -0800 (PST) Message-ID: <58871f9b.d635240a.4cda6.5322@mx.google.com> X-Google-Original-Message-ID: <1485250447-76866-1-git-send-email-Qiang(liqiang6-s@360.cn)> From: Li Qiang X-Google-Original-From: Li Qiang(liqiang6-s@360.cn) To: qemu-devel@nongnu.org, ghoffman@redhat.com Date: Tue, 24 Jan 2017 01:34:07 -0800 X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::241 Subject: [Qemu-devel] [PATCH] cirrus: fix oob access issue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liqiang6-s@360.cn Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Li Qiang When doing bitblt copy in backward mode, minus the blt width first to avoid an oob access issue. Signed-off-by: Li Qiang --- hw/display/cirrus_vga.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index 379910d..7ddd289 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -277,7 +277,8 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s, } if (pitch < 0) { int64_t min = addr - + ((int64_t)s->cirrus_blt_height-1) * pitch; + + ((int64_t)s->cirrus_blt_height-1) * pitch + - s->cirrus_blt_width; int32_t max = addr + s->cirrus_blt_width; if (min < 0 || max > s->vga.vram_size) {