Crash when selecting files

Things you’d like to miss in the future...
xyuser123
Posts: 18
Joined: 06 Feb 2019 05:14

Crash when selecting files

Post by xyuser123 »

Hi,

I've run into an issue which causes XYplorer to crash when selecting some very specific files. XYplorer calls DrawTextW with DT_END_ELLIPSIS, which in this case causes the string to become longer than it was previously and it overwrites other bytes on the heap.

It is a bit of an obscure problem but a fix would certainly be appreciated!

Thank you.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Crash when selecting files

Post by admin »

Well, it would certainly help if you told me the name of those files... :)

xyuser123
Posts: 18
Joined: 06 Feb 2019 05:14

Re: Crash when selecting files

Post by xyuser123 »

It is a folder containing some old versions of XYplorer:

Image

Selecting any of these subfolders causes XYplorer to crash, because the bug occurs when drawing the location. I have put some screenshots below to illustrate what I mean.

Before
Image

After
Image

I hope this helps.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Crash when selecting files

Post by admin »

What are these hex codes?

Which version of XY are you using?

Are you using any 3rd party themes?

What Windows version is this?

xyuser123
Posts: 18
Joined: 06 Feb 2019 05:14

Re: Crash when selecting files

Post by xyuser123 »

I forgot to mention that in my first post, sorry.

OS: Windows 7

XY version: 19.40, but the issue also happens to me on 19.60 (I tested it before making a bug report)

I am not using any third party themes.

The hex codes are a picture from the debugger that shows the string in memory that gets passed to DrawTextW. After the ellipsis is inserted you can see that it has overwritten the bytes after the end of the string, which is why XY crashes.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Crash when selecting files

Post by admin »

AFAIK the full path is not drawn on selecting a list item unless you are showing the Path column. Are you?

xyuser123
Posts: 18
Joined: 06 Feb 2019 05:14

Re: Crash when selecting files

Post by xyuser123 »

Hmm, I do not have that enabled. These are the only columns I have selected:

Image

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Crash when selecting files

Post by admin »

By "select" you mean just single-click (make the name selected), not double-click to go into a folder, right?

How do you select. Mouse or keyboard? Does it make a difference?

xyuser123
Posts: 18
Joined: 06 Feb 2019 05:14

Re: Crash when selecting files

Post by xyuser123 »

Yes, it is only necessary to select the file. It happens using both mouse and keyboard. Even if I just open that folder in XY and press the down arrow key, it crashes instantly.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Crash when selecting files

Post by admin »

Very strange. Of course, this does not happen here.

Stupid idea but it often helps: Reboot Windows...

xyuser123
Posts: 18
Joined: 06 Feb 2019 05:14

Re: Crash when selecting files

Post by xyuser123 »

The computer has been rebooted between discovering the problem and making the bug report, so rebooting does not affect it.

It is indeed a strange issue to track down because it depends on the exact width of the string and the exact width of the rectangle.

I debugged it some more and found that the problem lies in the code that draws the path in the properties panel.

Image

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Crash when selecting files

Post by admin »

Thanks, that helped! Although I could not make it crash here I think I found the cause of the trouble:

"F:\Downloads\Software\Utilities\XYplorer\Old\" is shortened to "F:\Downloads\Software\Utilities\XYplorer\Ol..." which takes less space although it has more characters! This constellation is rather rare, and I don't know why it does not lead to a crash here (win 8.1), but I'm sure your initial analysis was to the point: foreign bytes were overwritten.

The next beta should fix it.

xyuser123
Posts: 18
Joined: 06 Feb 2019 05:14

Re: Crash when selecting files

Post by xyuser123 »

I'm glad I could help! I've just tested the latest beta version and it no longer crashes when I select those folders. Thank you!

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Crash when selecting files

Post by admin »

I thank you. That was an interesting bug, and it was there forever, lurking in the dark, ready to hit anyone at any time. Not anymore! :tup:

tedy
Posts: 323
Joined: 17 Jun 2009 21:48

Re: Crash when selecting files

Post by tedy »

Strange, I couldn't reproduce myself and make it crash.
I'm not sure why, but for me it shortens in 'xyplorer' path element, not at the end (Old).
I tried Win 2016, then Win 7 (the screenshot is Win7).
xyshorten1.png
xyshorten1.png (17.34 KiB) Viewed 2135 times

Post Reply