ext/hash: Fix GH-16711: Segfault in mhash() Closes GH-16713
ext/hash: Add failing tests for GH-16711