#1150796 chr: Fix SIGSEGV in test suite search section

Package:
chr
Source:
chr
Description:
terminal-based text editor
Submitter:
Viktor Pashaiev
Date:
2026-10-13 19:53:17 UTC
Severity:
normal
Tags:
#1150796#5
Date:
2026-10-13 12:50:21 UTC
From:
To:
Dear Maintainer,

In Ubuntu stonking (and environments with Qt 6.11 / LTO / _FORTIFY_SOURCE=3),
the test suite crashes with a segmentation fault in SECTION("search")
at src/tests/filetests.cpp:786:

  actions
    search
  ../src/tests/filetests.cpp:786: FAILED:
  due to a fatal error condition:
    SIGSEGV - Segmentation violation signal
  1/1 editor:tests FAIL killed by signal 11 SIGSEGV

This happens because File instances are allocated with new and leaked in
the test cases. Leaked instances remain registered in the Qt event loop,
and when their terminal is destroyed, incoming events (such as
cursorPositionChanged) trigger a use-after-free SIGSEGV.

Upstream resolved this in commit 294293edbaf9ba03f169c25e88005dca5f9b79e5
("tests: filetests: Use unique_ptr to avoid File leaks.") by managing
File instances with std::unique_ptr.

The attached patch backports this fix to 0.1.81-1. With this patch applied,
all 12 test cases pass without errors.

Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/chr/+bug/2170633

Thanks,
Viktor Pashaiev

#1150796#10
Date:
2026-10-13 14:13:44 UTC
From:
To:
Dear Maintainer,

Further analysis showed that upstream commit 294293edbaf9ba03f169c25e88005dca5f9b79e5 alone
is not sufficient when the full test suite runs sequentially.

Instances of File were also leaked in readWrite() (src/tests/tests.cpp) and in
src/tests/attributes.cpp. These leaked instances remain active in the Qt event loop,
and when their terminal is destroyed, subsequent event loop iterations in later tests
trigger a use-after-free SIGSEGV in termpaint_text_measurement_feed_codepoint.

Upstream subsequently resolved these leaks as well:
- 294293edbaf9ba03f169c25e88005dca5f9b79e5 ("tests: filetests: Use unique_ptr to avoid File leaks.")
- 9657fd3ad95536c19c8b3f68987614d81b04845c ("tests: readWrite: Fix memory leak.")
- bbfd527dd697b4ffe57894c8f66da5cd18c50e91 ("tests: cleanAttributesFileName: Fix memory leak.")
- fbeb86f82fe942464944afacbdd314a11faf5bfe ("tests: attributes: Fix memory leak.")

The attached patch combines all four upstream fixes. With this patch applied,
all 17 test cases pass (2482 assertions, 0 failures) on both build-edit and build-tiny.

Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/chr/+bug/2170633

Thanks,
Viktor Pashaiev

#1150796#15
Date:
2026-10-13 13:18:44 UTC
From:
To:
Dear Maintainer,

Further analysis showed that upstream commit 294293edbaf9ba03f169c25e88005dca5f9b79e5 alone
is not sufficient when the full test suite runs sequentially.

Instances of File were also leaked in readWrite() (src/tests/tests.cpp) and in
src/tests/attributes.cpp. These leaked instances remain active in the Qt event loop,
and when their terminal is destroyed, subsequent event loop iterations in later tests
trigger a use-after-free SIGSEGV in termpaint_text_measurement_feed_codepoint.

Upstream subsequently resolved these leaks as well:
- 9657fd3ad95536c19c8b3f68987614d81b04845c ("tests: readWrite: Fix memory leak.")
- bbfd527dd697b4ffe57894c8f66da5cd18c50e91 ("tests: cleanAttributesFileName: Fix memory leak.")
- fbeb86f82fe942464944afacbdd314a11faf5bfe ("tests: attributes: Fix memory leak.")

The updated patch combines all four upstream test fixes. With this patch,
all 17 test cases pass (2482 assertions, 0 failures).

Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/chr/+bug/2170633

Thanks,
Viktor Pashaiev

#1150796#20
Date:
2026-10-13 19:49:32 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
chr, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1150796@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Christoph Hueffelmann <chr@istoph.de> (supplier of updated chr package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Tue, 13 Oct 2026 20:04:13 +0200
Source: chr
Architecture: source
Version: 0.1.82-1
Distribution: unstable
Urgency: medium
Maintainer: Christoph Hueffelmann <chr@istoph.de>
Changed-By: Christoph Hueffelmann <chr@istoph.de>
Closes: 1150796
Changes:
 chr (0.1.82-1) unstable; urgency=medium
 .
   * Fix memory leaks in tests. (Closes: #1150796)
Checksums-Sha1:
 7d4ab56105623b9da899c915c487c925f0ba3f25 2195 chr_0.1.82-1.dsc
 0b0366dbbbed4b0a6bb84c55ef083e650108445b 224151 chr_0.1.82.orig.tar.gz
 3a21d8575f63a9d7fdaa35450089f19f8b4b63e7 4204 chr_0.1.82-1.debian.tar.xz
 bfe36f16b14d605865767351665a2cf831eebeb2 16044 chr_0.1.82-1_source.buildinfo
Checksums-Sha256:
 bdff39392a1497c9e6a1a8d22a4fa75c1e0fb269fed875f756de94703efa5364 2195 chr_0.1.82-1.dsc
 276cae9337ac373e6dca884743d4e944905767f22e68fd23bfabea2a184bf69d 224151 chr_0.1.82.orig.tar.gz
 f62bc98d64ffe3352e1cc74fa3eaab81ff151f07f96f7cd0d7804386caa7042f 4204 chr_0.1.82-1.debian.tar.xz
 39640c2c79d7732406d587841cf0972e8f3aba3e0c9cb8ac0711956569f2bf00 16044 chr_0.1.82-1_source.buildinfo
Files:
 b68a8e19deb4b0fb810386698572eaca 2195 editors optional chr_0.1.82-1.dsc
 ba0c06e27db97d38c2d72d66d12490a6 224151 editors optional chr_0.1.82.orig.tar.gz
 9fdae46d9f4abe0d644be006ede41121 4204 editors optional chr_0.1.82-1.debian.tar.xz
 4360b3c2dbe0659764019f59f4de8f71 16044 editors optional chr_0.1.82-1_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEtgob82PcExn/Co6JEWhSvN91FcAFAmrOh5EACgkQEWhSvN91
FcC5KQ//SggGFtyEqwWekUKIgdW31jS+9d3bfu5jrI8T8tCbfilE1N5fCkJ08xcm
+OZlhF6kSHOSYkcQzKqBwqrtfhGJwQDSBwwpic48uQSXN/KW6HfnR5GO/JMV/h5L
13dXHjgJRkn2b19I6AW1Ugj30DP71vBDhwwqN4dut4XMolvILNLooBHXOmO5g6N4
XebtJMFuTlULqPAMxthrbLMTP7swnluooGPyhkTTpaFHdWRJrfSze7cDyKrWrGIv
M1hc1RD0e5PtRQ/UCu8zt/zSKey+ia9V04VtfwaGcWJZHqYnr954rNzYAbDIAeJu
Mq82jClOjS+icF+9SbmqNRiHuCLz/NbGZYjy5UoFpiT2In5kfar5/ZiSx0M02jhG
/x/ofqRvTHlODAg8ac849YuuMMQbfZ7YCzsOBxTyjbVAGA+dQBl1+NnBLfIk61dS
KCVkUC1S/+diXEqCIGoBPRArS0XEn4Cqy4kB2Lz69yn6Bfb9pVuyAc7zr02aMDXG
1n5Ggrx7JspHobLlRuGGQYpnUUAOIL83/aGxDc+mSP+ImT4yUgo/9TmSjprFPAFK
+3i7S0BxUe5YoYIIUkl0OP5CqqH0HdIIKlomdxz/i9xte1Cyg456NosHCjPOFlNO
nPJD4lRcmrKzbRnJii7YNLNG2ZxKu7pVFcSWJeEdm5KZL5nbuzg=
=iGIk
-----END PGP SIGNATURE-----