Crashes when drag drop object has certain path pattern #23347

Closed
opened 2026-01-31 08:39:36 +00:00 by claunia · 7 comments
Owner

Originally created by @8LWXpg on GitHub (Jun 8, 2025).

Windows Terminal version

1.22.11141.0

Windows build number

10.0.26100.0

Other Software

Wrote a basic Winforms app that performs file/folder drag drop

private void DragSource_MouseMove(object sender, MouseEventArgs e)
{
	if (e.Button != MouseButtons.Left)
	{
		return;
	}

	var dataObject = new DataObject(DataFormats.FileDrop, _path);
	DragDropEffects result = DoDragDrop(dataObject, Globals.ArgParser.Move ? DragDropEffects.Move : DragDropEffects.Copy);
	if (result is DragDropEffects.Move or DragDropEffects.Copy)
	{
		Application.Exit();
	}
}

02f21dca32/dwag/DrageSourceForm.cs (L65-L78)

Steps to reproduce

Certain path pattern cause wt to crash

  • Forward slash: E:/test.txt
  • Relative path: E:\test\..\test.txt, ., .\test.txt

https://github.com/user-attachments/assets/22a38ef8-88d8-49d4-8f75-0ce91d218b07

Expected Behavior

Handles path properly.

Actual Behavior

Crashes

Originally created by @8LWXpg on GitHub (Jun 8, 2025). ### Windows Terminal version 1.22.11141.0 ### Windows build number 10.0.26100.0 ### Other Software Wrote a basic Winforms app that performs file/folder drag drop ```cs private void DragSource_MouseMove(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { return; } var dataObject = new DataObject(DataFormats.FileDrop, _path); DragDropEffects result = DoDragDrop(dataObject, Globals.ArgParser.Move ? DragDropEffects.Move : DragDropEffects.Copy); if (result is DragDropEffects.Move or DragDropEffects.Copy) { Application.Exit(); } } ``` https://github.com/8LWXpg/dwag/blob/02f21dca322850c3fb2786f0e07ed2c630dcab4f/dwag/DrageSourceForm.cs#L65-L78 ### Steps to reproduce Certain path pattern cause wt to crash - Forward slash: `E:/test.txt` - Relative path: `E:\test\..\test.txt`, `.`, `.\test.txt` https://github.com/user-attachments/assets/22a38ef8-88d8-49d4-8f75-0ce91d218b07 ### Expected Behavior Handles path properly. ### Actual Behavior Crashes
Author
Owner

@DHowett commented on GitHub (Jun 11, 2025):

Well, that's not good.

@DHowett commented on GitHub (Jun 11, 2025): Well, that's not good.
Author
Owner

@DHowett commented on GitHub (Jun 11, 2025):

I first thought that it would be a problem in our path translation code, but you're pasting into an untranslated terminal control... so it's probably in the general drop handler here:

557a193cb7/src/cascadia/TerminalControl/TermControl.cpp (L3174-L3257)

@DHowett commented on GitHub (Jun 11, 2025): I first thought that it would be a problem in our path translation code, but you're pasting into an untranslated terminal control... so it's probably in the general drop handler here: https://github.com/microsoft/terminal/blob/557a193cb7affac7b1564c5fcd6d3a2ddc7e5fd6/src/cascadia/TerminalControl/TermControl.cpp#L3174-L3257
Author
Owner

@jamespack commented on GitHub (Jun 12, 2025):

What is the FullName ?. Powershell wouldn't give the RelativePath for FullName. It would give the fully rooted path. So im betting there is something in the path that Terminal doesnt like. Any change you could comment that? @8LWXpg

@jamespack commented on GitHub (Jun 12, 2025): What is the `FullName` ?. Powershell wouldn't give the `RelativePath` for `FullName`. It would give the fully rooted path. So im betting there is something in the path that Terminal doesnt like. Any change you could comment that? @8LWXpg
Author
Owner

@jamespack commented on GitHub (Jun 12, 2025):

Nevermind. It is the relative path. My bad.

@jamespack commented on GitHub (Jun 12, 2025): Nevermind. It is the relative path. My bad.
Author
Owner

@8LWXpg commented on GitHub (Jun 14, 2025):

The PR just prevent crashes but still not resolving relative path and forward slash, right?

@8LWXpg commented on GitHub (Jun 14, 2025): The PR just prevent crashes but still not resolving relative path and forward slash, right?
Author
Owner

@jamespack commented on GitHub (Jun 15, 2025):

Correct

@jamespack commented on GitHub (Jun 15, 2025): Correct
Author
Owner

@jamespack commented on GitHub (Jun 15, 2025):

The storage apis returned null. Hence the crash. That's upstream from terminal. Not sure where that bug should be filed if at all.

@jamespack commented on GitHub (Jun 15, 2025): The storage apis returned null. Hence the crash. That's upstream from terminal. Not sure where that bug should be filed if at all.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23347