Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

39817966: [WinAppSDK 1.1] Unpackaged + self-contained Blank Project crashes at startup #2562

Merged
merged 1 commit into from
Jun 1, 2022

Conversation

DrusTheAxe
Copy link
Member

@DrusTheAxe DrusTheAxe commented Jun 1, 2022

Undocked RegFree WinRT had a long-standing bug in ParseFileTag() where it retrieved the filename via xmlReader->GetValue() into a raw pointer and then used it AFTER calling xmlReader->Read(). That's a no-no -- GetValue returns a raw pointer to the current-context; you need to deep-copy if if you want to use it after you change the parser's current-context (e.g. by calling Read), as per https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms752870(v=vs.85)

Note

The pointer returned by GetValue is only valid until you move the reader to another node. When you move the reader to another node, XmlLite may reuse the memory referenced by the pointer. Therefore, you should not use the pointer after calling one of the following methods: Read, MoveToNextAttribute, MoveToFirstAttribute, MoveToAttributeByName, or MoveToElement. Although they do not move the reader, the following two methods will also make the pointer invalid: SetInput and IUnknown::Release. If you want to preserve the value that was returned in ppwszValue, you should make a deep copy.

The key phrase: When you move the reader to another node, XmlLite may reuse the memory referenced by the pointer. Therefore, you should not use the pointer after calling one of the following methods:...

This could coincidentally work if you had small RegFreeWinRT info in your manifest, but that was pure luck of memory layout.

This issue exists in URFW from before we forked copy. URFW should be likewise fixed, tracked per RegFreeWinRT support has bug in string handling that leads to failed DLL lookup #776

@DrusTheAxe
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MikeHillberg MikeHillberg merged commit 722e408 into main Jun 1, 2022
@MikeHillberg MikeHillberg deleted the user/drustheaxe/urfw-getvalue-deepcopy-error branch June 1, 2022 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants