Bug 1757959 - Segfault for empty DictStr when converted to string
Summary: Segfault for empty DictStr when converted to string
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: libcomps
Version: 8.0
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: 8.0
Assignee: amatej
QA Contact: Eva Mrakova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-10-02 19:53 UTC by Dana Walker
Modified: 2020-04-28 16:55 UTC (History)
1 user (show)

Fixed In Version: libcomps-0.1.11-3.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 16:55:20 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1854 0 None None None 2020-04-28 16:55:22 UTC

Description Dana Walker 2019-10-02 19:53:17 UTC
Description of problem:
Calling str() on empty DictStr object triggers a segfault.

Version-Release number of selected component (if applicable):
$ sudo dnf list installed | grep libcomps
libcomps.x86_64                      0.1.11-1.fc30                          @anaconda       
libcomps-devel.x86_64                0.1.11-1.fc30                          @fedora         
python3-libcomps.x86_64              0.1.11-1.fc30                          @anaconda    

How reproducible:
The following python script will reproduce the problem consistently:

import libcomps
import urllib.request

url_empty_strdict = 'https://repos.fedorapeople.org/pulp/pulp/fixtures/rpm-unsigned/repodata/5e655c4cde94fe5f1a39ed2015d5a5bbfa051fa032b3fb911609ada337b5fee8-comps.xml'
url_non_empty_strdict = 'https://dl.fedoraproject.org/pub/epel/7/x86_64/repodata/c629c8fc439517aed1ff09d9c8ba32f2fa6984a2f9683e4cd19726591f68128b-comps-Everything.x86_64.xml'

def test(url):
file_path = '/tmp/test_comps.xml'
urllib.request.urlretrieve(url, file_path)
comps = libcomps.Comps()
comps.fromxml_f(file_path)
print(comps.categories[0].desc_by_lang)

test(url_empty_strdict) # segfault
#test(url_non_empty_strdict) # no segfault


Steps to Reproduce:
See above

Actual results:
segfault

Expected results:
no segfault

Additional info:
We are using the python bindings so not sure if it extends beyond that.

Opened an issue on Github as well:
https://github.com/rpm-software-management/libcomps/issues/54

Comment 1 amatej 2019-10-07 12:29:00 UTC
I created a PR that should fix this:
https://github.com/rpm-software-management/libcomps/pull/56

It also contains a commit with some simple test.

Comment 6 errata-xmlrpc 2020-04-28 16:55:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1854


Note You need to log in before you can comment on or make changes to this bug.