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

[Bug]: CTD when passing an empty character as the second argument when executing PapyrusUtil's MiscUtil.WriteToFile function #1661

Open
oto-git opened this issue Aug 12, 2023 · 5 comments
Assignees

Comments

@oto-git
Copy link

oto-git commented Aug 12, 2023

Severity

Critical. A critical defect that causes some key functionality to fail.
(However, the conditions under which this occurs are quite limited, so we set a lower priority.)

Priority

Low. All else (typos, missing icons, layout issues, etc.).

  • In addition to what I found when I confirmed that it works with my personal mods, there are no mods that call the MiscUtil.WriteToFile function on the SkyrimPlatform side as far as I know,
    And there is a workaround if you use it to create an empty directory for a mod like I did,
    I think the priority is quite low, because this phenomenon is not seen unless you use it to clear the contents when generating logs or something like that. (We reported it in passing because it is a CTD that occurred under specific conditions.)

Description

Tried calling PapyrusUtil 's MiscUtil.WriteToFile function on the SkyrimPlatform side using Papyrus-2-Typescript,
We confirmed that passing an empty string as the second argument caused a CTD.

NetScriptFramework Crash Log: https://drive.google.com/file/d/1QRwMiDIHtfhDCXBXIRk2YrmC1Baus0A-/view?usp=sharing

When using the MiscUtil.WriteToFile function to create an empty directory for mods, the old version did not generate a CTD even if the second argument was an empty character.
Therefore, we have checked the behavior of each version of MiscUtil.WriteToFile function when the second argument is passed an empty character,
We confirmed that the CTD did not occur if the version of SkyrimPlatform is 2.5.
We confirmed that the CTD occurs when the version is 2.6 and 2.7.1.

OS

Windows

OS version

10

Skyrim version

1.5.97.0.8

SKSE version

2.0.20

client commit''s hash

None

server commit''s hash

None

Videocard model

Radeon RX 590

Steps to reproduce

import { on, once, unsubscribe, printConsole, Utility, EventHandle } from "skyrimPlatform"
import * as MiscUtil from "../../../Modules/PapyrusUtil/MiscUtil"

export let main = () => {
	once('update', () => {
		let szFilePath = 'Data\\SKSE\\Test\\dummy.txt';
		MiscUtil.WriteToFile(szFilePath, '', false, false);
	});
};

Assign an empty string to the second argument of MiscUtil.WriteToFile as above and execute.

Expected result

The function is executed normally without CTD.
(The directory "Data\SKSE\Test\ is created and dummy.txt is generated there.)

Actual result

CTD occurs during function execution
(A directory called Data\SKSE\Test\ is created and dummy.txt is generated there, but it is CTD.)

@Pospelove
Copy link
Contributor

@oto-git by the way, does it crash in Papyrus? I'm asking because I can't find PapyrusUtil sources and don't really know what exactly it does under the hood

@Keidran
Copy link
Contributor

Keidran commented Nov 15, 2023

@Pospelove
Copy link
Contributor

@Pospelove mb this one https://github.com/eeveelo/PapyrusUtil?

looks like that, thank you

@oto-git
Copy link
Author

oto-git commented Feb 20, 2024

On the Papyrus side, the CTD does not occur when an empty string is specified as the second argument to MiscUtil.WriteToFile.
We have confirmed that the CTD occurs only when executed on the Skyrim Platform side.
To add, CTDs due to this issue continue to be identified in the latest version 1.8.

@oto-git
Copy link
Author

oto-git commented Feb 20, 2024

#1858
I found a similar problem with PapyrusUtil's JsonUtil.GetStringValue where a CTD occurs when an empty character is specified as the third argument, so I reported it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants