Windows - SegmentationFault for strings with length greater than 117 chars
Closed this issue · 1 comments
f-bl commented
Hi! Great, very useful library!
I've run into an issue when writing strings with a length greater than 117 chars to the clipboard on Windows (tested 10 and 11).
On Linux it works fine. I can't test MacOS.
I can't make much sense of the error messages:
PS Z:\Documents\Projects\Learning\Zig\Experiments\Clipboard\zig-out\bin> .\ClipboardTest.exe
Segmentation fault at address 0x1ef268d1000
/home/name/.cache/zig/p/122010ab564ba5f1782e39d4059cbd8fe36b3118c3888bfb3a6b7c6e50fe6f514eba/src/clipboard_windows.zig:58:18: 0x271398 in write (ClipboardTest.exe.obj)
/home/name/.cache/zig/p/122010ab564ba5f1782e39d4059cbd8fe36b3118c3888bfb3a6b7c6e50fe6f514eba/src/clipboard.zig:22:34: 0x2717d6 in write (ClipboardTest.exe.obj)
/home/name/Documents/Projects/Learning/Zig/Experiments/Clipboard/src/main.zig:7:19: 0x271885 in main (ClipboardTest.exe.obj)
/home/name/.config/Code/User/globalStorage/ziglang.vscode-zig/zig_install/lib/std/start.zig:363:53: 0x2718fc in WinStartup (ClipboardTest.exe.obj)
???:?:?: 0x7ffd868f7373 in ??? (KERNEL32.DLL)
???:?:?: 0x7ffd86a3cc90 in ??? (ntdll.dll)
I've used the following simple program to test the exact limit:
const std = @import("std");
const clip = @import("clipboard");
pub fn main() !void {
try clip.write("#" ** 116);
try clip.write("#" ** 117);
try clip.write("#" ** 118); // <<- Crash occurs here
}