microsoft / MSIX-PackageSupportFramework

The Package Support Framework (PSF) is a kit for applying compatibility fixes to packaged desktop applications.
MIT License
115 stars 57 forks source link

File Redirection Fixup causes application crash when reading INI #163

Closed MihaiUdrea closed 1 year ago

MihaiUdrea commented 3 years ago

Calls to GetPrivateProfileSection with null filename causes the fixup and app to crash.

I would suggest updating

https://github.com/microsoft/MSIX-PackageSupportFramework/blob/14ec90a7acc8ee15f33b11e6ef22b6fe3e334541/fixups/FileRedirectionFixup/GetPrivateProfileSectionFixup.cpp#L23

to use widen_argument

dhoehna commented 3 years ago

Hey MihaiUdrea,

Does the crash happen only with ini files?

MihaiUdrea commented 3 years ago

It seams so. Don't really know the client API that it used, we encounter this when testing EnSoft>LPILE package with FileRedirection fixup present.

TimMangan commented 3 years ago

Darren,

The PrivateProfile APIs are only used for ini files. We have run into issues with apps calling some of the file based apis with a null in the parameter of the filename. I previously added protection in several of the file based wrappers to directly call the underlying api to allow it to return as it normally would. - Tim

TimMangan commented 3 years ago

Daren - I took a deeper look at this. It appears that GetPrivateProfileSectionInstance line 23 is the cause as it was not protected by the null check. I don't have time to address this myself right now.

For MijailUdrea: I believe you can avoid this issue by configuring the tool during packaging. If the ini file exists inside the package, the call would not be made in a way that triggers this issue. LPile (and other Ensoft products I have tested) works OK with the FRF if an ini file is included.

TimMangan commented 3 years ago

This bothered me over night so I took another look. I did fix this last year and the fix is in the Develop branch.

dhoehna commented 3 years ago

Yeah. Most people are using master still. I still need to fix the tests in develop branch before I move everything to master.

npuvvada commented 1 year ago

This issue is fixed from PSF release : version 1.0.220926.1