Skip to content

Commit 6e62dc3

Browse files
CBL-Mariner-Botliulanzejslobodzian
authored
[AUTO-CHERRYPICK] Added a patch to address CVE-2024-56732 for qtbase. - branch 3.0-dev (#11974)
Co-authored-by: Lanze Liu <[email protected]> Co-authored-by: jslobodzian <[email protected]>
1 parent 24d1355 commit 6e62dc3

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

SPECS/qtbase/CVE-2024-56732.patch

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
From 1767f99e2e2196c3fcae27db6d8b60098d3f6d26 Mon Sep 17 00:00:00 2001
2+
From: Behdad Esfahbod <[email protected]>
3+
Date: Sun, 10 Nov 2024 22:43:28 -0700
4+
Subject: [PATCH] [cairo] Guard hb_cairo_glyphs_from_buffer() against bad UTF-8
5+
6+
Previously it was assuming valid UTF-8.
7+
---
8+
src/3rdparty/harfbuzz-ng/src/hb-cairo.cc | 2 ++
9+
src/3rdparty/harfbuzz-ng/src/hb-utf.hh | 6 ++++--
10+
2 files changed, 6 insertions(+), 2 deletions(-)
11+
12+
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-cairo.cc b/src/3rdparty/harfbuzz-ng/src/hb-cairo.cc
13+
index d8b582c4908..4d22ae059ff 100644
14+
--- a/src/3rdparty/harfbuzz-ng/src/hb-cairo.cc
15+
+++ b/src/3rdparty/harfbuzz-ng/src/hb-cairo.cc
16+
@@ -1000,6 +1000,7 @@ hb_cairo_glyphs_from_buffer (hb_buffer_t *buffer,
17+
end = start + hb_glyph[i].cluster - hb_glyph[i+1].cluster;
18+
else
19+
end = (const char *) hb_utf_offset_to_pointer<hb_utf8_t> ((const uint8_t *) start,
20+
+ (const uint8_t *) utf8, utf8_len,
21+
(signed) (hb_glyph[i].cluster - hb_glyph[i+1].cluster));
22+
(*clusters)[cluster].num_bytes = end - start;
23+
start = end;
24+
@@ -1020,6 +1021,7 @@ hb_cairo_glyphs_from_buffer (hb_buffer_t *buffer,
25+
end = start + hb_glyph[i].cluster - hb_glyph[i-1].cluster;
26+
else
27+
end = (const char *) hb_utf_offset_to_pointer<hb_utf8_t> ((const uint8_t *) start,
28+
+ (const uint8_t *) utf8, utf8_len,
29+
(signed) (hb_glyph[i].cluster - hb_glyph[i-1].cluster));
30+
(*clusters)[cluster].num_bytes = end - start;
31+
start = end;
32+
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-utf.hh b/src/3rdparty/harfbuzz-ng/src/hb-utf.hh
33+
index 1120bd1cccf..6db9bf2fd79 100644
34+
--- a/src/3rdparty/harfbuzz-ng/src/hb-utf.hh
35+
+++ b/src/3rdparty/harfbuzz-ng/src/hb-utf.hh
36+
@@ -458,19 +458,21 @@ struct hb_ascii_t
37+
template <typename utf_t>
38+
static inline const typename utf_t::codepoint_t *
39+
hb_utf_offset_to_pointer (const typename utf_t::codepoint_t *start,
40+
+ const typename utf_t::codepoint_t *text,
41+
+ unsigned text_len,
42+
signed offset)
43+
{
44+
hb_codepoint_t unicode;
45+
46+
while (offset-- > 0)
47+
start = utf_t::next (start,
48+
- start + utf_t::max_len,
49+
+ text + text_len,
50+
&unicode,
51+
HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT);
52+
53+
while (offset++ < 0)
54+
start = utf_t::prev (start,
55+
- start - utf_t::max_len,
56+
+ text,
57+
&unicode,
58+
HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT);

SPECS/qtbase/qtbase.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@
3535
Name: qtbase
3636
Summary: Qt6 - QtBase components
3737
Version: 6.6.3
38-
Release: 1%{?dist}
38+
Release: 2%{?dist}
3939
# See LICENSE.GPL3-EXCEPT.txt, for exception details
4040
License: GFDL AND LGPLv3 AND GPLv2 AND GPLv3 with exceptions AND QT License Agreement 4.0
4141
Vendor: Microsoft Corporation
4242
Distribution: Azure Linux
4343
URL: https://qt-project.org/
4444
%global majmin %(echo %{version} | cut -d. -f1-2)
4545
Source0: https://download.qt.io/archive/qt/%{majmin}/%{version}/submodules/%{qt_module}-everywhere-src-%{version}.tar.xz
46+
Patch0: CVE-2024-56732.patch
4647

4748
BuildRequires: build-essential
4849
BuildRequires: systemd
@@ -700,6 +701,9 @@ fi
700701
%{_qt_plugindir}/platformthemes/libqxdgdesktopportal.so
701702

702703
%changelog
704+
* Thu Jan 16 2025 Lanze Liu <[email protected]> - 6.6.3-2
705+
- Added a patch for addressing CVE-2024-56732
706+
703707
* Wed Jan 15 2025 Lanze Liu <[email protected]> - 6.6.3-1
704708
- Upgrade to version 6.6.3 to fix CVE-2024-30161
705709

0 commit comments

Comments
 (0)