There was an off-by-one error caused by an index (which included an index for the null section header) being used to check against the size of a list of sections (which didn't include the null section header).
This is a partial fix for https://bugs.llvm.org/show_bug.cgi?id=50506.