private void processMemoryReference(Map<String, Object> result, boolean overwrite) {
		try {
			Address fromAddr = getLocation(result);
			if (fromAddr == null) {
				throw new AddressFormatException("Incompatible Memory Reference FROM Address");
			}

			String toAddrStr = (String) result.get("to");
			if (toAddrStr == null) {
				throw new RuntimeException("TO_ADDRESS attribute missing for MEMORY_REFERENCE element");
			}
			Address toAddr = parseAddress(factory, toAddrStr);
			if (toAddr == null) {
				throw new AddressFormatException("Incompatible Memory Reference TO Address: " + toAddrStr);
			}

			int opIndex = CodeUnit.MNEMONIC;
			if (result.get("opIndex") != null) {
				opIndex = (int) (double) result.get("opIndex");
			}

			boolean primary = false;
			if (result.get("primary") != null) {
				primary = (boolean) result.get("primary");
			}

			Address baseAddr = null;
			if (result.get("base") != null) {
				baseAddr = parseAddress(factory, (String) result.get("base"));
			}

			if (!overwrite) {
				Reference[] existingMemRefs = refManager.getReferencesFrom(fromAddr, opIndex);
				if (existingMemRefs != null && existingMemRefs.length != 0 && !existingMemRefs[0].isMemoryReference()) {
					log.appendMsg("Reference already exists from [" + fromAddr + "] to [" + toAddr
							+ "] on operand [" + opIndex + "]");
					return;
				}
			}

			int index = Integer.parseInt((String) result.get("index"));
			RefType refType = getRefType(index);

			SourceType sourceType = getSourceType((String) result.get("sourceType"));
			ReferenceManager refMgr = program.getReferenceManager();
			Reference ref;
			if (baseAddr != null) {
				long offset = (long) (double) result.get("offset");
				// long offset = toAddr.subtract(baseAddr);
				ref = refMgr.addOffsetMemReference(fromAddr, toAddr, toAddr.equals(baseAddr), offset, refType,
						sourceType, opIndex);
			} else {
				ref = refMgr.addMemoryReference(fromAddr, toAddr, refType, sourceType, opIndex);
			}
			refMgr.setPrimary(ref, primary);

		} catch (Exception e) {
			log.appendException(e);
		}
	}
@param result
@param language
@param overwrite
Ghidra/Features/Sarif/src/main/java/sarif/managers/MarkupSarifMgr.java