Skip to content

Commit

Permalink
conf: Test for segfaulting iterator in ConfigParser
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-kolarik committed Dec 10, 2024
1 parent 69d1f64 commit 4f38415
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/conf/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,17 @@ def test_empty_option(self):
conf.config_file_path = FN
conf.read()
self.assertEqual(conf.reposdir, '')

def test_iterator_segfault(self):
# https://bugzilla.redhat.com/show_bug.cgi?id=2330562
empty_conf_path = tests.support.resource_path('etc/empty.conf')

parser = ConfigParser()
parser.read(empty_conf_path)
self.assertTrue(parser.hasSection("main"))

sectObj = parser.getData()["main"]
[item for item in sectObj]

# this should not segfault
[item for item in iter(sectObj)]
1 change: 1 addition & 0 deletions tests/etc/empty.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[main]

0 comments on commit 4f38415

Please sign in to comment.