libde265: patch CVE-2025-61147

Details: https://nvd.nist.gov/vuln/detail/CVE-2025-61147

Backport the patch referenced by the NVD advisory.

Note that this is a partial backport - only the parts that are
used by the application, and without pulling in c++17 headers.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
This commit is contained in:
Gyorgy Sarvari 2026-03-21 12:39:58 +01:00 committed by Anuj Mittal
parent 54c8a4ad6c
commit 2ca25f2279
No known key found for this signature in database
GPG Key ID: 4340AEFE69F5085C
2 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,84 @@
From 83c32b9e37f206b1b22f5cc971c817147e39273b Mon Sep 17 00:00:00 2001
From: Dirk Farin <dirk.farin@gmail.com>
Date: Tue, 9 Sep 2025 15:14:05 +0200
Subject: [PATCH] check for valid integer command line parameters (#484)
OE comment:
This is a partial backport of the below mentioned patch, without raising
the required c++ standard.
CVE: CVE-2025-61147
Upstream-Status: Backport [https://github.com/strukturag/libde265/commit/8b17e0930f77db07f55e0b89399a8f054ddbecf7]
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
dec265/dec265.cc | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/dec265/dec265.cc b/dec265/dec265.cc
index 8ddecfc2..84ec69a5 100644
--- a/dec265/dec265.cc
+++ b/dec265/dec265.cc
@@ -27,6 +27,9 @@
#define DO_MEMORY_LOGGING 0
#include "de265.h"
+#include <stdexcept>
+#include <iostream>
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -557,6 +560,32 @@ void (*volatile __malloc_initialize_hook)(void) = init_my_hooks;
#endif
#endif
+int parse_param(const char* arg, int lower_bound, const char* arg_name){
+ int value;
+
+ try {
+ size_t len;
+ value = std::stoi(optarg, &len);
+ if (arg[len] != 0) {
+ std::cerr << "invalid argument to " << arg_name << "\n";
+ exit(5);
+ }
+ } catch (std::invalid_argument const& ex) {
+ std::cerr << "invalid argument to " << arg_name << "\n";
+ exit(5);
+ }
+ catch (std::out_of_range const& ex) {
+ std::cerr << "argument to -T is out of range\n";
+ exit(5);
+ }
+
+ if (value < lower_bound) {
+ std::cerr << "argument to " << arg_name << " may not be smaller than " << lower_bound << "\n";
+ exit(5);
+ }
+
+ return value;
+}
int main(int argc, char** argv)
{
@@ -573,9 +602,9 @@ int main(int argc, char** argv)
switch (c) {
case 'q': quiet++; break;
- case 't': nThreads=atoi(optarg); break;
+ case 't': nThreads=parse_param(optarg, 0, "-t"); break;
case 'c': check_hash=true; break;
- case 'f': max_frames=atoi(optarg); break;
+ case 'f': max_frames=parse_param(optarg, 1, "-f"); break;
case 'o': write_yuv=true; output_filename=optarg; break;
case 'h': show_help=true; break;
case 'd': dump_headers=true; break;
@@ -587,7 +616,7 @@ int main(int argc, char** argv)
case 'm': measure_quality=true; reference_filename=optarg; break;
case 's': show_ssim_map=true; break;
case 'e': show_psnr_map=true; break;
- case 'T': highestTID=atoi(optarg); break;
+ case 'T': highestTID = parse_param(optarg, 0, "-T"); break;
case 'v': verbosity++; break;
}
}

View File

@ -11,7 +11,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=695b556799abb2435c97a113cdca512f"
SRC_URI = "git://github.com/strukturag/libde265.git;branch=master;protocol=https \
file://CVE-2023-43887.patch \
file://CVE-2023-47471.patch \
"
file://CVE-2025-61147.patch \
"
SRCREV = "a267c84707ab264928fa9b86de2ee749c48c318c"
S = "${WORKDIR}/git"