FS#75551 - [telegram-desktop] Crash on resize below a certain width, when a full-width image is in it

Attached to Project: Community Packages
Opened by Christian Sturm (Athaba) - Monday, 08 August 2022, 16:51 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Thursday, 08 December 2022, 22:59 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
When resizing Telegram to a low width while in the "chat view" Telegram crashes.

Version used: 4.0.2-4 I am pretty sure this has happened for a couple of versions
This doesn't happen with the executable provided by Telegram.
I was using i3, so it's kind of annoying, when telegram might crash right away on opening from the tray, when there was little space left for it.

Steps to reproduce:
* Open telegram-desktop
* Make sure you are in a chat (so select a contact) and have a full-width/height image in the chat. Doesn't seem to happen when Telegram resized that image, because of its resolution.
* Lower the width so it is very small (sorry not sure how to best get an exact number of pixels) until it crashes

Crash:
/usr/include/c++/12.1.0/bits/stl_algo.h:3623: constexpr const _Tp& std::clamp(const _Tp&, const _Tp&, const _Tp&) [with _Tp = int]: Assertion '!(__hi < __lo)' failed.
[1] 9687 IOT instruction (core dumped) telegram-desktop
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Thursday, 08 December 2022, 22:59 GMT
Reason for closing:  Upstream
Comment by Sven-Hendrik Haase (Svenstaro) - Monday, 08 August 2022, 19:41 GMT
Does this also happen with the upstream version?

EDIT: Nevermind, I'm blind.
Comment by Christian Sturm (Athaba) - Monday, 08 August 2022, 19:48 GMT
No, it doesn't, and with the packaged one I noticed that it seems to be only in certain steps, so for anyone trying to reproduce this don't be surprised if it doesn't work the first time. It has to be really close in though. If anyone had a suggestion to measure the width, I'd be happy to find it out to help with reproduction.
Comment by Sven-Hendrik Haase (Svenstaro) - Thursday, 10 November 2022, 10:54 GMT
I can't reproduce this with the current version. Can you retry?
Comment by Christian Sturm (Athaba) - Thursday, 10 November 2022, 20:05 GMT
This issue still exists for me.

Two things to notice here:

I use i3, a tiling window manager which seems to allow to make it smaller than usually possible.

As mentioned before it might take a bit of trying to get the right width. I wonder if elements in chats also make a difference. I'll try to experiment further.
Comment by Christian Sturm (Athaba) - Thursday, 10 November 2022, 20:20 GMT
Here is a reliable way to reproduce it:

* Have a YouTube link in Saved Message (so there is a preview of the video)

* Install wmctrl to set position and size of windows
* Open Telegram
* Run wmctrl -l to get the window id of Telegram (the very left value)
* If you are on a tiling window manager (like i3) you have to get it out of tiling (Shift-Meta-Space on i3)
* Run wmctrl -i -r <id> -e 0,500,500,300,400 (the 500,500 is position, the 300,400 dimensions)
* This should resize your telegram window
* When you now click on Saved Messages the crash will occur

It also occurs in other scenarios like in calls, but the above is the easiest thing I was able to come up with.
Comment by Christian Sturm (Athaba) - Thursday, 10 November 2022, 20:23 GMT
(added this comment into the description above)
Comment by Sven-Hendrik Haase (Svenstaro) - Sunday, 13 November 2022, 06:52 GMT
Can reproduce now. Sadly, it doesn't mean that I have any idea how to fix it and why it only happens in our package.
Comment by Christian Sturm (Athaba) - Thursday, 08 December 2022, 22:21 GMT
I didn't try it with the official version with the exact steps. I just didn't manage to reproduce it before. I do now. So I filed a bug report with the project:

https://github.com/telegramdesktop/tdesktop/issues/25539
Comment by Sven-Hendrik Haase (Svenstaro) - Thursday, 08 December 2022, 22:59 GMT
Thanks. Though seeing as it's now clearly an upstream bug (despite them saying they don't even want to try to handle it), I will stop tracking it here.

Loading...