Skip to content

Commit ac62105

Browse files
Fixed inconsistencies generated by _md_shrink. (#1229)
This is causing assertion failures in ASSERT_CONSISTENT if an entry used to have a non null identity. Since the new entries will be concentrated at the beginning of the array, we shall "erase" the old entries that are at the end of the array and that won't be used anymore. This is enough to fix the core dump issues found in the testsuite of httpie in Fedora Rawhide (see #1195 (comment))
1 parent 8ea6942 commit ac62105

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

CHANGES/1229.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed inconsistencies generated by the C implementation of ``_md_shrink()`` which might later lead to assertion failures and crash -- by :user:`Romain-Geissler-1A`.

multidict/_multilib/hashtable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ _md_shrink(MultiDictObject *md, bool update)
261261
keys->nentries = newnentries;
262262
keys->usable += nentries - newnentries;
263263
memset(&keys->indices[0], 0xff, ((size_t)1 << keys->log2_index_bytes));
264+
memset(new_ep, 0, sizeof(entry_t) * (size_t)(nentries - newnentries));
264265
if (htkeys_build_indices(keys, entries, newnentries, update) < 0) {
265266
return -1;
266267
}

0 commit comments

Comments
 (0)