boolean doSetLengthOverride(int len) throws CodeUnitInsertionException {

		int protoLength = proto.getLength();
		len = checkLengthOverride(len, proto);
		if (len == lengthOverride) {
			return false; // no change
		}

		int instrLength = len != 0 ? len : protoLength;
		if (instrLength > getLength()) {
			Address newEndAddr = address.add(instrLength - 1);
			Address nextCodeUnitAddr = codeMgr.getDefinedAddressAfter(address);
			if (nextCodeUnitAddr != null && nextCodeUnitAddr.compareTo(newEndAddr) <= 0) {
				throw new CodeUnitInsertionException("Length override of " + instrLength +
					" conflicts with code unit at " + nextCodeUnitAddr);
			}
		}

		flags &= LENGTH_OVERRIDE_CLEAR_MASK;
		flags |= (len << LENGTH_OVERRIDE_SHIFT);
		codeMgr.setFlags(addr, flags);

		endAddr = null;
		refreshLength();

		addLengthOverrideFallthroughRef();

		return true;
	}
Check and revise a specified {@code length} to arrive at a suitable length-override value.
@param length instruction byte-length (must be in the range 0..{@code prototype-length}).
If smaller than the prototype length it must have a value no greater than 7, otherwise
an error will be thrown.  A value of 0 or greater-than-or-equal the prototype length
will be ignored and not impose and override length.  The length value must be a multiple 
of the {@link Language#getInstructionAlignment() instruction alignment} .
@param prototype instruction prototype
@return length-override value (0 = disable length-override) 
@throws CodeUnitInsertionException thrown if the new Instruction would overlap and 
existing {@link CodeUnit} or the specified {@code length} is unsupported.
@throws IllegalArgumentException if a negative {@code length} is specified.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/InstructionDB.java