Skip to content

Commit bd6ccfb

Browse files
committed
conf: Test for segfaulting iterator in ConfigParser
This is a follow-up to rpm-software-management/libdnf#1682. Reported bug: https://bugzilla.redhat.com/show_bug.cgi?id=2330562
1 parent 69d1f64 commit bd6ccfb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: tests/conf/test_parser.py

+14
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,17 @@ def test_empty_option(self):
6666
conf.config_file_path = FN
6767
conf.read()
6868
self.assertEqual(conf.reposdir, '')
69+
70+
def test_iterator_segfault(self):
71+
# https://bugzilla.redhat.com/show_bug.cgi?id=2330562
72+
empty_conf_path = tests.support.resource_path('etc/empty.conf')
73+
74+
parser = ConfigParser()
75+
parser.read(empty_conf_path)
76+
self.assertTrue(parser.hasSection("main"))
77+
78+
sectObj = parser.getData()["main"]
79+
[item for item in sectObj]
80+
81+
# this should not segfault
82+
[item for item in iter(sectObj)]

0 commit comments

Comments
 (0)