Reject headers that build on an invalid parent

Rebased-From: 34970223472c9e83689a1c710eebc7c16f152b02
Github-Pull: #5459