Bug 275350 - graphics/qt6-svg: null dereference crash when launching telegram-desktop after 6.6.0 upgrade
Summary: graphics/qt6-svg: null dereference crash when launching telegram-desktop afte...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-kde (group)
URL: https://github.com/qt/qtsvg/commit/ef...
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-26 10:03 UTC by Guido Falsi
Modified: 2023-11-26 16:19 UTC (History)
3 users (show)

See Also:


Attachments
patch v1 (948 bytes, patch)
2023-11-26 11:59 UTC, Guido Falsi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Guido Falsi freebsd_committer freebsd_triage 2023-11-26 10:03:58 UTC
Hi!

First of all thanks to all people working on this port and keeping qt libraries up to date.

Unluckily, after the update to qt 6.6.0 in ports commit 1d76bdf62dffad91834699701f41d3374dfb6a3a the qt6 flavor of telegram desktop fails to start.

I don't have debug enabled binaries available, and have not investigated mush, but I got this using lldb:

```
(lldb) run
Process 4360 launched: '/usr/local/bin/telegram-desktop' (x86_64)
[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
QPainter::begin: Paint device returned engine == 0, type: 2
QWidget::render: Cannot render with an inactive painter
qt.svg: Error while inflating gzip file: SVG format check failed
qt.svg: Error while inflating gzip file: SVG format check failed
Process 4360 stopped
* thread #10, name = 'telegram-desktop', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
    frame #0: 0x0000000843ed9376 libQt6Svg.so.6`___lldb_unnamed_symbol1597 + 38
libQt6Svg.so.6`___lldb_unnamed_symbol1597:
->  0x843ed9376 <+38>: movq   (%rdi), %rax
    0x843ed9379 <+41>: callq  *0x18(%rax)
    0x843ed937c <+44>: cmpl   $0x2, %eax
    0x843ed937f <+47>: jae    0x843ed93e0               ; <+144>
(lldb) 
```

Looks like this affects linux too and has already been reported upstream:

https://github.com/telegramdesktop/tdesktop/issues/27134


The issue could be in qt6svg but I was unable to find a bug report about this in qt6 bug reporting system.
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2023-11-26 10:06:03 UTC
Adding osa to this bug since he has been updating the port and may have knowledge useful to fix it.
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2023-11-26 10:43:49 UTC
I found some useful information via SUSE forums:

https://lists.opensuse.org/archives/list/factory@lists.opensuse.org/thread/M53D4PDB2Q5FIJA6XU4KPLJBPM362VUT/

Looks like the qt bug is https://bugreports.qt.io/browse/QTBUG-117944

I'll try to cook up a patch including the upstream fix.
Comment 3 Guido Falsi freebsd_committer freebsd_triage 2023-11-26 11:59:05 UTC
I finally found the commit with a fix:

https://github.com/qt/qtsvg/commit/effc44495a33babd4cf7a2044123f420e6b3da1c

I've created a patch that fixes it in the ports tree.

Tested it in poudriere, and running fine on head.

Hope this can be approved/merged soon.
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2023-11-26 11:59:37 UTC
Created attachment 246579 [details]
patch v1

Patch applying https://github.com/qt/qtsvg/commit/effc44495a33babd4cf7a2044123f420e6b3da1c from upstream
Comment 5 Jason E. Hale freebsd_committer freebsd_triage 2023-11-26 13:37:00 UTC
Approved! Please go ahead and commit. I should have Qt 6.6.1 ready around the middle of this week which includes this patch, but probably better to patch it now in case I run into problems or upstream delays the release again.
Comment 6 commit-hook freebsd_committer freebsd_triage 2023-11-26 16:18:35 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=986fd4e1a413aab152d54026fd0df8bd87b6da45

commit 986fd4e1a413aab152d54026fd0df8bd87b6da45
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2023-11-26 16:15:10 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2023-11-26 16:15:10 +0000

    graphics/qt6-svg: Import patch to fix null dereference at runtime

    PR:             275350
    Approved by:    kde (jhale)
    Obtained from:  https://github.com/qt/qtsvg/commit/effc44495a33babd4cf7a2044123f420e6b3da1c

 graphics/qt6-svg/Makefile                                  |  1 +
 graphics/qt6-svg/files/patch-src_svg_qsvghandler.cpp (new) | 11 +++++++++++
 2 files changed, 12 insertions(+)
Comment 7 Guido Falsi freebsd_committer freebsd_triage 2023-11-26 16:19:21 UTC
(In reply to Jason E. Hale from comment #5)

Thanks for the fast approval, just committed it.

I was not sure when 6.6.1 was planned to land, and I thought this one was bad enough to warrant a dedicated patch.

Thanks again for all the work on qt and kde!