Page 1 of 2
Crash when selecting files
Posted: 06 Feb 2019 05:44
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.
Re: Crash when selecting files
Posted: 07 Feb 2019 09:29
by admin
Well, it would certainly help if you told me the name of those files...

Re: Crash when selecting files
Posted: 07 Feb 2019 18:39
by xyuser123
It is a folder containing some old versions of XYplorer:
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
After
I hope this helps.
Re: Crash when selecting files
Posted: 07 Feb 2019 18:58
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?
Re: Crash when selecting files
Posted: 07 Feb 2019 19:26
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.
Re: Crash when selecting files
Posted: 07 Feb 2019 19:52
by admin
AFAIK the full path is not drawn on selecting a list item unless you are showing the Path column. Are you?
Re: Crash when selecting files
Posted: 07 Feb 2019 20:30
by xyuser123
Hmm, I do not have that enabled. These are the only columns I have selected:

Re: Crash when selecting files
Posted: 07 Feb 2019 21:12
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?
Re: Crash when selecting files
Posted: 07 Feb 2019 21:44
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.
Re: Crash when selecting files
Posted: 07 Feb 2019 21:51
by admin
Very strange. Of course, this does not happen here.
Stupid idea but it often helps: Reboot Windows...
Re: Crash when selecting files
Posted: 08 Feb 2019 06:08
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.

Re: Crash when selecting files
Posted: 08 Feb 2019 09:17
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.
Re: Crash when selecting files
Posted: 08 Feb 2019 18:35
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!
Re: Crash when selecting files
Posted: 08 Feb 2019 18:40
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!

Re: Crash when selecting files
Posted: 08 Feb 2019 20:48
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 (17.34 KiB) Viewed 3323 times