From patchwork Fri Sep 11 21:41:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 517029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B2268140518 for ; Sat, 12 Sep 2015 07:41:56 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=P9cbodAa; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=ZMLSu9qTH78SRKUwXK71xzEiZotIqzQ9v+tpClImjvZy17 iUy/RhoppzyBA2rHMBsrMGRLRfyiziEPPvj6/OQt7UeiGvcq71udrsO5iISEyJzg 5pK9hpNRnJlVQ5OsQLwFO71qtPvmZPtD/Bck8+voxrTyLUrYbs6iLUspsqFfE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=3g44D+nxjmv2rU6DyLqcjAMiHYE=; b=P9cbodAaziEDrzpcRZh7 fsfAq+9y8RK9yoG2ldIASHPC3UF+KUBQyxq6GI1MrV9dJP1xFeNC2B8UJMuNLVym kQ7JHWS2ajtd6FMzgPCrx+6CtcM02+dDlfr5yMEw//VLpCXGjTrcjuBYXHQ89D3G T4C0vOrN9lSTe/lPiKqkxoA= Received: (qmail 33237 invoked by alias); 11 Sep 2015 21:41:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 33202 invoked by uid 89); 11 Sep 2015 21:41:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_40, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-io0-f180.google.com Received: from mail-io0-f180.google.com (HELO mail-io0-f180.google.com) (209.85.223.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 11 Sep 2015 21:41:35 +0000 Received: by ioiz6 with SMTP id z6so112588903ioi.2 for ; Fri, 11 Sep 2015 14:41:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=9qr7+YHCV1P3hD9MzrVxFn9OrNekAN9kv3TBUhBuPME=; b=V/c6uoaphx0+d0UOx+2v5jBY6glRp4b75h/R7nJ3AI2i8k2JYe1ph1jm+NdDQ0S8mO 0Wckztztg10I7ZMLGJxUFZrKMAtLcXF1P7qokGRn5/i7ZyYGSHIZGQ+f44lKZFgRr0J+ +HM1AN+KFquuBZsRmJWFzvy9taqFuBoE00J6lDyr2JRG8m+aMerE0Bzd1+DPQS7APUPM Ho7sFr8M/ucfoUBHf9kg1WzAYQz9xOiHi3fL3oGja3t1GULvPhtHZOyxsu1XKrOhUlma 4Pxp1ePJLFhK3nx9yzyYM1Y9Aarkj9TvxE6hKxKksHksJPCBwLHeddqxxFTrDg+QCUjx Ef9A== X-Gm-Message-State: ALoCoQlVCQw8C4GOhMbuss+RVxXyNVKRWuQZ6HT+Qt1XJ8n1Ikb62648qI24dQOBRXpA+Gv/nmWv MIME-Version: 1.0 X-Received: by 10.107.9.222 with SMTP id 91mr7789202ioj.107.1442007693457; Fri, 11 Sep 2015 14:41:33 -0700 (PDT) Received: by 10.79.102.133 with HTTP; Fri, 11 Sep 2015 14:41:33 -0700 (PDT) Date: Fri, 11 Sep 2015 14:41:33 -0700 Message-ID: Subject: Go patch committed: Fix possible out of bounds memcmp From: Ian Lance Taylor To: gcc-patches , "gofrontend-dev@googlegroups.com" This patch by Chris Manghane fixes the Go frontend to avoid a possible out of bounds memcmp when looking for a go:nointerface comment. This fixes https://golang.org/issue/11577 . Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 227696) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -352617bfe0a880febf5d2a87e89ea439c742ba18 +aea4360ca9c37f8e929f177ae7e42593ee62aa79 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/lex.cc =================================================================== --- gcc/go/gofrontend/lex.cc (revision 227696) +++ gcc/go/gofrontend/lex.cc (working copy) @@ -1752,7 +1752,9 @@ Lex::skip_cpp_comment() // For field tracking analysis: a //go:nointerface comment means // that the next interface method should not be stored in the type // descriptor. This permits it to be discarded if it is not needed. - if (this->lineoff_ == 2 && memcmp(p, "go:nointerface", 14) == 0) + if (this->lineoff_ == 2 + && pend - p > 14 + && memcmp(p, "go:nointerface", 14) == 0) this->saw_nointerface_ = true; while (p < pend)