skymp icon indicating copy to clipboard operation
skymp copied to clipboard

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

Open oto-git opened this issue 10 months ago • 5 comments

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.)

oto-git avatar Aug 12 '23 05:08 oto-git