* Follow-up to PR #4300: prevent potential overflow PR #4300 introduced the rationale for validating heap_type. This patch moves the validation before the computation of type1 to prevent potential overflow.
* Follow-up to PR #4300: prevent potential overflow PR #4300 introduced the rationale for validating heap_type. This patch moves the validation before the computation of type1 to prevent potential overflow.