WASM crash when calling Gauge API function get_name_of_named_variable

Version: 1.37.19.0

Frequency: Frequently

Severity: High

Context: What package? When editing or mounted from Community? In main menu or in flight? etc…
In Flight

Bug description:
I have a WASM module that scans for available lvars using the following code fragment:

			// Check if more lvars available
			int noLvarsAvailable = 0, msgLength;
			bool isValidLVAR = true;
			PCSTRINGZ lvarname;
			do {
				lvarname = get_name_of_named_variable(noLvarsAvailable);
				if (lvarname)
				{
					msgLength = snprintf(szLogBuffer, 512, "    Lvar found:  id %d = '%s'", noLvarsAvailable, lvarname);
					if (msgLength > 0 && msgLength < 512)
						LOG_TRACE(szLogBuffer);
					else
					{
						snprintf(szLogBuffer, 512, "*** Lvar id %d (%d chars): '%s'", noLvarsAvailable, strlen(lvarname), lvarname);
						LOG_ERROR(szLogBuffer);
					}
					noLvarsAvailable++;
				}
				else
					isValidLVAR = false;
			} while (isValidLVAR);

This generally works just fine. However, it seems that in certain circumstances (which I personally am unable to reproduce) this code can crash the WASM in the call to get_name_of_named_variable

Repro steps:
I cannot reproduce this, but have determined that the WASM is crashing here due to others who are using my WASM. It seems that this crash only occurs when using complex aircraft AND complex scenery. I have tried to reproduce when running my WASM in an attached debugger many times without success, but the WASM crash does occur quite frequently for some of the users of my WASM module.
Is it possible that some scenery or add-on is corrupting the lvar name space that is causing this issue?

Attachments:

Private attachments: Send a PM to @PrivateContent with the link to this topic and the link to download your content

I am not sure I should have raised this as a bug, as I cannot reproduce and it seems to occur when using multiple add-ons. Shall I delete this bug report and re-submit as a question?
It is a serious issue though for many of my users and any information on how to track this down further would be much appreciated. For example, as I cannot reproduce this myself, is there any way I can get a crash dump of the WASM from users who experience this issue so that I can submit this to Asobo for analysis?