public boolean isValid() throws IOException {
		final int MIN_BYTE_LENGTH = 22;
		final int COFF_NULL_SANITY_CHECK_LEN = 64;

		if (reader.length() < MIN_BYTE_LENGTH) {
			return false;
		}

		short magic = reader.readShort(0);

		if (magic == CoffMachineType.IMAGE_FILE_MACHINE_UNKNOWN /* ie. == 0 */ &&
			reader.length() > COFF_NULL_SANITY_CHECK_LEN) {
			byte[] headerBytes = reader.readByteArray(0, COFF_NULL_SANITY_CHECK_LEN);
			boolean allZeros = true;
			for (byte b : headerBytes) {
				allZeros = (b == 0);
				if (!allZeros) {
					break;
				}
			}
			if (allZeros) {
				return false;
			}
		}

		return CoffMachineType.isMachineTypeDefined(magic);
	}
Tests if the given {@link ByteProvider} is a valid {@link CoffFileHeader}.
<p>
To avoid false positives when the machine type is 
{@link CoffMachineType#IMAGE_FILE_MACHINE_UNKNOWN}, we do an additional check on some extra
bytes at the beginning of the given {@link ByteProvider} to make sure the entire file isn't
all 0's.

@return True if this is a is a valid {@link CoffFileHeader}; otherwise, false
@throws IOException if there was an IO-related issue
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/coff/CoffFileHeader.java