From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16618 invoked by alias); 22 Dec 2010 23:57:43 -0000 Received: (qmail 16598 invoked by uid 22791); 22 Dec 2010 23:57:42 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD,T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Dec 2010 23:57:38 +0000 Received: from wpaz33.hot.corp.google.com (wpaz33.hot.corp.google.com [172.24.198.97]) by smtp-out.google.com with ESMTP id oBMNvZ6V010041 for ; Wed, 22 Dec 2010 15:57:35 -0800 Received: from pva4 (pva4.prod.google.com [10.241.209.4]) by wpaz33.hot.corp.google.com with ESMTP id oBMNvXw7014122 for ; Wed, 22 Dec 2010 15:57:33 -0800 Received: by pva4 with SMTP id 4so1294940pva.5 for ; Wed, 22 Dec 2010 15:57:33 -0800 (PST) Received: by 10.142.224.15 with SMTP id w15mr3553479wfg.60.1293062253162; Wed, 22 Dec 2010 15:57:33 -0800 (PST) Received: from coign.google.com (dhcp-172-22-121-194.mtv.corp.google.com [172.22.121.194]) by mx.google.com with ESMTPS id p8sm9827257wff.16.2010.12.22.15.57.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 22 Dec 2010 15:57:32 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Don't crash on invalid call to append Date: Thu, 23 Dec 2010 00:41:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-12/txt/msg01745.txt.bz2 --=-=-= Content-length: 321 This patch to the Go frontend avoids crashing on an invalid call to append. In some cases at check_types time there can be too many arguments, despite an earlier call to lower_varargs. This patch avoids a crash in that case. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=foo.patch Content-Description: crash Content-length: 553 diff -r 9582ee2b931c go/expressions.cc --- a/go/expressions.cc Wed Dec 22 15:45:21 2010 -0800 +++ b/go/expressions.cc Wed Dec 22 15:52:55 2010 -0800 @@ -7387,8 +7387,11 @@ this->report_error(_("not enough arguments")); break; } - /* Lowering varargs should have left us with 2 arguments. */ - gcc_assert(args->size() == 2); + if (args->size() > 2) + { + this->report_error(_("too many arguments")); + break; + } std::string reason; if (!Type::are_assignable(args->front()->type(), args->back()->type(), &reason)) --=-=-=--