From owner-svn-src-projects@FreeBSD.ORG Sun Jan 19 13:38:40 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B0F23F66; Sun, 19 Jan 2014 13:38:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9D5371DA4; Sun, 19 Jan 2014 13:38:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0JDceT2023103; Sun, 19 Jan 2014 13:38:40 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0JDceL0023102; Sun, 19 Jan 2014 13:38:40 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201401191338.s0JDceL0023102@svn.freebsd.org> From: Kai Wang Date: Sun, 19 Jan 2014 13:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r260878 - projects/elftoolchain/contrib/elftoolchain/libdwarf X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jan 2014 13:38:40 -0000 Author: kaiw Date: Sun Jan 19 13:38:40 2014 New Revision: 260878 URL: http://svnweb.freebsd.org/changeset/base/260878 Log: Add a sanity check: The provided offset for the desired location list should not exceed the size of the .debug_loc section. Modified: projects/elftoolchain/contrib/elftoolchain/libdwarf/libdwarf_loclist.c Modified: projects/elftoolchain/contrib/elftoolchain/libdwarf/libdwarf_loclist.c ============================================================================== --- projects/elftoolchain/contrib/elftoolchain/libdwarf/libdwarf_loclist.c Sun Jan 19 07:44:14 2014 (r260877) +++ projects/elftoolchain/contrib/elftoolchain/libdwarf/libdwarf_loclist.c Sun Jan 19 13:38:40 2014 (r260878) @@ -127,6 +127,11 @@ _dwarf_loclist_add(Dwarf_Debug dbg, Dwar return (DW_DLE_NO_ENTRY); } + if (lloff >= ds->ds_size) { + DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY); + return (DW_DLE_NO_ENTRY); + } + if ((ll = malloc(sizeof(struct _Dwarf_Loclist))) == NULL) { DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY); return (DW_DLE_MEMORY);