commit 60b68e6291ba5cbbcef1ac092397b92e9f1fbe87
Author: Dominik 'Rathann' Mierzejewski <dominik(a)greysector.net>
Date: Thu May 16 01:04:27 2024 +0200
Backport a fix for crashes when encoding with variable length SEI
This is also included in HandBrake upstream x265 fork.
https://bitbucket.org/multicoreware/x265_git/pull-requests/10
x265-sei-length-crash-fix.patch | 29 +++++++++++++++++++++++++++++
x265.spec | 7 ++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
---
diff --git a/x265-sei-length-crash-fix.patch b/x265-sei-length-crash-fix.patch
new file mode 100644
index 0000000..87c6d49
--- /dev/null
+++ b/x265-sei-length-crash-fix.patch
@@ -0,0 +1,29 @@
+From 8454caf458c5f5d20cce711ff8ea8de55ec1ae50 Mon Sep 17 00:00:00 2001
+From: harlanc <hailiang8(a)staff.weibo.com>
+Date: Thu, 1 Dec 2022 07:46:13 +0000
+Subject: [PATCH] fix crash when SEI length is variable
+
+---
+ source/encoder/encoder.cpp | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
+index 0fea6553c..5a3fcafc7 100644
+--- a/source/encoder/encoder.cpp
++++ b/source/encoder/encoder.cpp
+@@ -1103,6 +1103,12 @@ void Encoder::copyUserSEIMessages(Frame *frame, const
x265_picture* pic_in)
+ input = seiMsg;
+ else
+ input = pic_in->userSEI.payloads[i];
++
++ if (frame->m_userSEI.payloads[i].payload &&
(frame->m_userSEI.payloads[i].payloadSize < input.payloadSize))
++ {
++ delete[] frame->m_userSEI.payloads[i].payload;
++ frame->m_userSEI.payloads[i].payload = NULL;
++ }
+
+ if (!frame->m_userSEI.payloads[i].payload)
+ frame->m_userSEI.payloads[i].payload = new
uint8_t[input.payloadSize];
+--
+2.45.0
+
diff --git a/x265.spec b/x265.spec
index ad3020d..1cfa787 100644
--- a/x265.spec
+++ b/x265.spec
@@ -6,7 +6,7 @@
Summary: H.265/HEVC encoder
Name: x265
Version: 3.6
-Release: 1%{?dist}
+Release: 2%{?dist}
URL:
http://x265.org/
# source/Lib/TLibCommon - BSD
# source/Lib/TLibEncoder - BSD
@@ -18,6 +18,8 @@ Source0:
https://bitbucket.org/multicoreware/%{name}_git/downloads/%{name}_%{
Patch0: x265-pic.patch
Patch1: x265-high-bit-depth-soname.patch
Patch2: x265-pkgconfig_path_fix.patch
+#
https://bitbucket.org/multicoreware/x265_git/pull-requests/10
+Patch3:
https://bitbucket.org/harlancc/x265_git/commits/8454caf458c5f5d20cce711ff...
BuildRequires: gcc-c++
BuildRequires: git
@@ -152,6 +154,9 @@ done
%{_libdir}/pkgconfig/x265.pc
%changelog
+* Thu May 16 2024 Dominik Mierzejewski <rpm(a)greysector.net> - 3.6-2
+- Backport a fix for crashes when encoding with variable length SEI
+
* Sat Apr 06 2024 Leigh Scott <leigh123linux(a)gmail.com> - 3.6-1
- Update to 3.6