From patchwork Mon Oct 26 18:28:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 55575 Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1354660lbq; Mon, 26 Oct 2015 11:28:59 -0700 (PDT) X-Received: by 10.50.83.6 with SMTP id m6mr20840769igy.90.1445884139265; Mon, 26 Oct 2015 11:28:59 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 84si26056390ioh.110.2015.10.26.11.28.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Oct 2015 11:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-return-89514-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; spf=pass (google.com: domain of binutils-return-89514-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-89514-patch=linaro.org@sourceware.org; dkim=pass header.i=@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; q=dns; s=default; b=Tf3mXXf1qWdHZRCIOKRm9SVBqNWI/ NCn4ddhnexbQ7iTazrU3BZ14PdVkoiYX6KCYWK9PV76I3tf44kH1hxSR0V8SbKU+ 0F5Jl44YCo6fcR6f153fAWTEZlH2ZGdxffsJaO5hE1AnHMPXoH+k1yF9se5cAPlK 15WpTVbw1qe0dM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; s=default; bh=AlBDuHNu6GiMX4ymEQSRpQcMPyY=; b=PZ7 VRgDJ3970quyXvmqVQyC/UpRCgtOt3HvZSStS5Ujk3BCiE+2QFlOOiY2tHy6wpi4 LFXhsyK6YPRyabZ0TZ70qwbKNP7PNH0W+jNyTQmiFejYuYVIIxMGNP2L9iKJRw/n RhT8WsUox8gRvCw53pjBj5hTkngj5RQi9WHHPpyw= Received: (qmail 99608 invoked by alias); 26 Oct 2015 18:28:45 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 99592 invoked by uid 89); 26 Oct 2015 18:28:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f171.google.com Received: from mail-ob0-f171.google.com (HELO mail-ob0-f171.google.com) (209.85.214.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 26 Oct 2015 18:28:43 +0000 Received: by obbwb3 with SMTP id wb3so150945369obb.0 for ; Mon, 26 Oct 2015 11:28:41 -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=A7SAOANwUvOQJaCTADTP9IuSvRRSyTBsJAW7lqyilJc=; b=bSpvoMsO3wNANY2XVXibF53rQvddu5bc5i28dsOCN+ZRaGjwXCIrSCiiTW4A5zUo4O SfQbVJthqe5HJkl6NuJ/YBZbhrPqdnTduEp8JVJ9AOjLG58zK8jlxbqOCSKxlASqvmDb i+7CJcF3eoOPJlwBW3eMyj5RoXXG5DP8HTpX0s13f1YMpOozianS3+qnsiIeNoceED/Q BrV55/a2fe5ctRVRuSwDITp6ny9sytRHof3XU0sq7H9D9Fc7qCNAp1oJTpZjdRh0f9B0 JAu/l2G94nXvFn0W6dt5OV/3EFwgVmEKQao0x1Bpoj2OiHVpghAhtjazL6CkQa0NhS/M NUvA== X-Gm-Message-State: ALoCoQl9R32EIxt/mCeSsrD5VwyBGVggjo6wmDxD4yE3UvaMJQ/zOE0iCgBwB6p8V55iDM7AW7mq MIME-Version: 1.0 X-Received: by 10.60.178.104 with SMTP id cx8mr5390520oec.28.1445884121165; Mon, 26 Oct 2015 11:28:41 -0700 (PDT) Received: by 10.76.172.136 with HTTP; Mon, 26 Oct 2015 11:28:41 -0700 (PDT) Date: Mon, 26 Oct 2015 11:28:41 -0700 Message-ID: Subject: [PATCH] [ARM] fix buffer overflow in gas From: Jim Wilson To: Binutils On Ubuntu 14.04, I get palantir:2062$ cat tmp.s .cpu exynos-m1 palantir:2063$ ./as-new tmp.s *** buffer overflow detected ***: ./as-new terminated ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x7338f)[0x7f984612538f] /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f98461bcc9c] /lib/x86_64-linux-gnu/libc.so.6(+0x109b60)[0x7f98461bbb60] ./as-new[0x42e227] ... The problem is that the string "Samsung Exynos M1" is 18 characters long including the trailing null byte, but the select_cpu_name array is only 16 characters long. This patch increases it to 20 to make the string fit and allow a little breathing room. Tested with a cross build and make check. Jim gas/ 2015-10-26 Jim Wilson * config/tc-arm.c (selected_cpu_name): Increase from 16 to 20. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index efc522a..a98a22a 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -266,7 +266,7 @@ static int mfloat_abi_opt = -1; /* Record user cpu selection for object attributes. */ static arm_feature_set selected_cpu = ARM_ARCH_NONE; /* Must be long enough to hold any of the names in arm_cpus. */ -static char selected_cpu_name[16]; +static char selected_cpu_name[20]; extern FLONUM_TYPE generic_floating_point_number;