RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1888343 - Calling the clear method on a StrDict will cause a segfault.
Summary: Calling the clear method on a StrDict will cause a segfault.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: libcomps
Version: 8.2
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: 8.0
Assignee: amatej
QA Contact: Jan Blazek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-14 15:45 UTC by sean.vinsick@gd-ms.com
Modified: 2021-05-18 15:01 UTC (History)
3 users (show)

Fixed In Version: libcomps-0.1.11-5.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-18 15:01:28 UTC
Type: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description sean.vinsick@gd-ms.com 2020-10-14 15:45:08 UTC
User-Agent:       Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Build Identifier: 

Calling the clear method on a StrDict will cause a segfault if converted to a string afterwards.

$ sudo dnf list installed | grep libcomps
libcomps.x86_64           0.1.11-4.el8   @rhel-8-for-x86_64-baseos-rpms
libcomps-devel.x86_64     0.1.11-4.el8   @rhel-8-for-x86_64-baseos-rpms
python3-libcomps.x86_64   0.1.11-4.el8   @rhel-8-for-x86_64-baseos-rpms

Running this as a script will cause the segfault everytime:
import libcomps
import urllib.request

url = 'http://mirror.metrocast.net/fedora/epel/8/Everything/x86_64/repodata/7566a18455054e4ce6b28bda7c181f66dd9958ed35c66f2b23612fa1f1f5c591-comps-Everything.x86_64.xml'
file_path = '/tmp/testcomp.xml'

urllib.request.urlretrieve(url, file_path)
comps = libcomps.Comps()
comps.fromxml_f(file_path)

#printing comp file works fine
print(comps.toxml_str())

#calling clear() on a StrDict
comps.categories[0].name_by_lang.clear()

# segfault occurs:
print(comps.toxml_str())

Output:
Fatal Python error: Segmentation fault

Current thread 0x00007f147aad6640 (most recent call first):
  File "<stdin>", line 1 in <module>
Segmentation fault (core dumped)






 

Reproducible: Always

Steps to Reproduce:
See above
Actual Results:  
segfault

Expected Results:  
no segfault

A work around is to create and assign a new empty StrDict object:

comps.categories[0].name_by_lang = libcomps.StrDict()

Comment 1 amatej 2020-10-22 12:10:23 UTC
Thank you for the reproducer!

PR with a fix: https://github.com/rpm-software-management/libcomps/pull/75

Since this is an API problem the PR also contains a short unittest for this situation (similar to the described reproducer).

Comment 11 errata-xmlrpc 2021-05-18 15:01:28 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 (dnf bug fix and enhancement update), 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-2021:1657


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