From owner-svn-src-all@FreeBSD.ORG Tue Nov 8 23:54:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AD4C106566C; Tue, 8 Nov 2011 23:54:39 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B5528FC14; Tue, 8 Nov 2011 23:54:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA8NsdKZ055082; Tue, 8 Nov 2011 23:54:39 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA8NsdhP055080; Tue, 8 Nov 2011 23:54:39 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201111082354.pA8NsdhP055080@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 8 Nov 2011 23:54:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227369 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2011 23:54:39 -0000 Author: jilles Date: Tue Nov 8 23:54:39 2011 New Revision: 227369 URL: http://svn.freebsd.org/changeset/base/227369 Log: sh: Remove undefined behaviour due to overflow in +/-/* in arithmetic. With i386 base gcc and i386 base clang, arith_yacc.o remains unchanged. Modified: head/bin/sh/arith_yacc.c Modified: head/bin/sh/arith_yacc.c ============================================================================== --- head/bin/sh/arith_yacc.c Tue Nov 8 23:44:26 2011 (r227368) +++ head/bin/sh/arith_yacc.c Tue Nov 8 23:54:39 2011 (r227369) @@ -131,11 +131,11 @@ static arith_t do_binop(int op, arith_t yyerror("divide error"); return op == ARITH_REM ? a % b : a / b; case ARITH_MUL: - return a * b; + return (uintmax_t)a * (uintmax_t)b; case ARITH_ADD: - return a + b; + return (uintmax_t)a + (uintmax_t)b; case ARITH_SUB: - return a - b; + return (uintmax_t)a - (uintmax_t)b; case ARITH_LSHIFT: return a << b; case ARITH_RSHIFT: