From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id CC1A6138CCC for ; Mon, 4 May 2015 06:43:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 57965E0881; Mon, 4 May 2015 06:43:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 01853E0881 for ; Mon, 4 May 2015 06:43:46 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2AFF0340AC1 for ; Mon, 4 May 2015 06:43:45 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CE8B5722 for ; Mon, 4 May 2015 06:43:43 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1430721718.1375a55bd6f9a35ee1a4b4ec78b84f830cfb41a9.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/util/__init__.py X-VCS-Directories: pym/portage/util/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 1375a55bd6f9a35ee1a4b4ec78b84f830cfb41a9 X-VCS-Branch: master Date: Mon, 4 May 2015 06:43:43 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 37ad6871-4c86-440c-8622-20864f14bbe9 X-Archives-Hash: f1f8ece718711863c24904b4a5eab64c commit: 1375a55bd6f9a35ee1a4b4ec78b84f830cfb41a9 Author: Zac Medico gentoo org> AuthorDate: Mon May 4 05:55:20 2015 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon May 4 06:41:58 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1375a55b varexpand: fix IndexError (bug 548556) This handles two cases where varexpand incremented the index without checking bounds. X-Gentoo-Bug: 548556 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=548556 X-Gentoo-forum-thread: https://forums.gentoo.org/viewtopic-t-1016432.html Acked-by: Brian Dolbec gentoo.org> pym/portage/util/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index 48cd1b7..c0b509b 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -850,8 +850,20 @@ def varexpand(mystring, mydict=None, error_leader=None): continue elif current == "$": pos += 1 + if pos == length: + # shells handle this like \$ + newstring.append(current) + continue + if mystring[pos] == "{": pos += 1 + if pos == length: + msg = _varexpand_unexpected_eof_msg + if error_leader is not None: + msg = error_leader() + msg + writemsg(msg + "\n", noiselevel=-1) + return "" + braced = True else: braced = False