Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
elfutils.8903
libdw-check-end-of-attributes-list-consistently...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libdw-check-end-of-attributes-list-consistently.patch of Package elfutils.8903
From 6983e59b727458a6c64d9659c85f08218bc4fcda Mon Sep 17 00:00:00 2001 From: Mark Wielaard <mark@klomp.org> Date: Sat, 18 Aug 2018 19:51:27 +0200 Subject: [PATCH] libdw: Check end of attributes list consistently. Reference: bnc#1107067 dwarf_child (__libdw_find_attr), dwarf_getabbrevattr[_data] and dwarf_getattrs all assume the end of the attribute list is when both the name (code) and form of the attribute are zero. dwarf_getabbrev (__libdw_getabbrev) and dwarf_hasattr assume the end of the attribute list is when either the name (code) or the form of the attribute is zero. The DWARF spec says: "The series of attribute specifications ends with an entry containing 0 for the name and 0 for the form." So the first check is correct. Make sure dwarf_getabbrev and dwarf_hasattr use the same check. This is important since all other functions expect dwarf_getabbrev (__libdw_getabbrev) to have done a data sanity check of the attribute. So if the ending condition is different it could cause a crash. https://sourceware.org/bugzilla/show_bug.cgi?id=23529 elfutils packaging edits: - hunk#1 in dwarf_getabbrev.c backported from original patch - changelog hunk removed from original patch to avoid conflict Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Joao Moreira <jmoreira@suse.de> --- libdw/ChangeLog | 7 +++++++ libdw/dwarf_getabbrev.c | 2 +- libdw/dwarf_hasattr.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libdw/dwarf_getabbrev.c b/libdw/dwarf_getabbrev.c index 988d12c..6a7e981 100644 --- a/libdw/dwarf_getabbrev.c +++ b/libdw/dwarf_getabbrev.c @@ -134,7 +134,7 @@ goto invalid; get_uleb128 (attrform, abbrevp, end); } - while (attrname != 0 && attrform != 0 && ++abb->attrcnt); + while ((attrname != 0 || attrform != 0) && ++abb->attrcnt); /* Return the length to the caller if she asked for it. */ if (lengthp != NULL) diff --git a/libdw/dwarf_hasattr.c b/libdw/dwarf_hasattr.c index 90053b1..eca0839 100644 --- a/libdw/dwarf_hasattr.c +++ b/libdw/dwarf_hasattr.c @@ -72,8 +72,8 @@ dwarf_hasattr (Dwarf_Die *die, unsigned int search_name) goto invalid_dwarf; get_uleb128 (attr_form, attrp, endp); - /* We can stop if we found the attribute with value zero. */ - if (attr_name == 0 || attr_form == 0) + /* We can stop if we found the end of the attribute list. */ + if (attr_name == 0 && attr_form == 0) return 0; if (attr_name == search_name) -- 2.9.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor