private Address findEndOfString() {
		// search for an end-of-string location
		// 1) null terminator
		// 2) inbound ref
		// 3) end-of-memory-block
		Address max = addrs.getFirstRange().getMaxAddress();
		Address bufStart = addrs.getFirstRange().getMinAddress();
		try {
			do {
				Address refdAddr = breakOnRef ? getNextRefdAddr(bufStart, max) : null;
				if (refdAddr != null) {
					max = refdAddr;
				}

				int bytesToRead = (int) Math.min(buffer.length, max.subtract(bufStart) + 1);
				int bytesRead = memory.getBytes(bufStart, buffer, 0, bytesToRead);
				if (bytesRead <= 0) {
					break;
				}
				for (int nullIndex = 0; nullIndex <= bytesRead - charSize; nullIndex += charSize) {
					if (isNullChar(nullIndex)) {
						// found a null term char, return it (inclusive)
						return bufStart.addNoWrap(nullIndex + charSize - 1);
					}
				}

				if (refdAddr != null) {
					// always terminate if there was a inbound ref
					return refdAddr.previous();
				}

				// loop and read next chunk and try again
				bufStart = bufStart.addNoWrap(bytesRead);
			}
			while (bufStart.compareTo(max) <= 0);
		}
		catch (MemoryAccessException | AddressOverflowException e) {
			// terminate loop/method
		}
		return max;
	}
Creates a new UndefinedStringIterator instance.

@param program {@link Program}
@param addrs set of {@link Address}es to search.
@param charSize size of the characters (and the null-terminator) that make up the string
@param charAlignment alignment requirements for the start of the string 
@param breakOnRef boolean flag, if true strings will be terminated early at locations that
have an in-bound memory reference
@param singleStringMode boolean flag, if true only one string will be returned, and it must
be located at the start of the specified address set (after alignment tweaks)
@param stringDataType a string data type that corresponds to the type of string being
searched for
@param stringSettings {@link Settings} for the string data type
@param monitor {@link TaskMonitor}
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/strings/UndefinedStringIterator.java