[perl #118649] maint-5.18: Digest-SHA crash fix in 5.85

Backported minimal changes from blead