Fixes a core dump when fed with a faulty pack file and related malicious take over Reviewed-by: jrose