gnuplot: fix CVE-2025-31180

CVE-2025-31180:
A flaw was found in gnuplot. The CANVAS_text() function may lead to a
segmentation fault and cause a system crash.

Reference:
[https://nvd.nist.gov/vuln/detail/CVE-2025-31180]

Upstream patches:
[https://sourceforge.net/p/gnuplot/gnuplot-main/ci/b2343fd02c4fff94957f0151b73daa0a1f7fec49/]

Signed-off-by: Zhang Peng <peng.zhang1.cn@windriver.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
This commit is contained in:
Zhang Peng
2025-09-02 15:44:31 +08:00
committed by Anuj Mittal
parent 02d046e20d
commit 732f5800cf
2 changed files with 44 additions and 0 deletions
@@ -0,0 +1,43 @@
From ec0fa6117d8e98918a030e31c2e8df32ab6e4542 Mon Sep 17 00:00:00 2001
From: Ethan A Merritt <merritt@u.washington.edu>
Date: Tue, 14 Jan 2025 21:54:14 -0800
Subject: [PATCH] canvas: handle nonlinear x2 or y2 axis with an incomplete
definition
Actually "handle" means "ignore".
But now it doesn't segfault trying to probe a non-existant link function.
Bug 2755
CVE: CVE-2025-31180
Upstream-Status: Backport [https://sourceforge.net/p/gnuplot/gnuplot-main/ci/b2343fd02c4fff94957f0151b73daa0a1f7fec49/]
Signed-off-by: Zhang Peng <peng.zhang1.cn@windriver.com>
---
term/canvas.trm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/term/canvas.trm b/term/canvas.trm
index fee3e5dfa..e796cec0d 100644
--- a/term/canvas.trm
+++ b/term/canvas.trm
@@ -646,7 +646,7 @@ CANVAS_text()
} else
fprintf(gpoutfile, "gnuplot.plot_axis_x2min = \"none\"\n");
if (axis_array[SECOND_X_AXIS].linked_to_primary
- && axis_array[FIRST_X_AXIS].link_udf->at) {
+ && axis_array[FIRST_X_AXIS].link_udf && axis_array[FIRST_X_AXIS].link_udf->at) {
fprintf(gpoutfile, "gnuplot.x2_mapping = function(x) { return x; };");
fprintf(gpoutfile, " // replace returned value with %s\n",
axis_array[FIRST_X_AXIS].link_udf->definition);
@@ -657,7 +657,7 @@ CANVAS_text()
} else
fprintf(gpoutfile, "gnuplot.plot_axis_y2min = \"none\"\n");
if (axis_array[SECOND_Y_AXIS].linked_to_primary
- && axis_array[FIRST_Y_AXIS].link_udf->at) {
+ && axis_array[FIRST_Y_AXIS].link_udf && axis_array[FIRST_Y_AXIS].link_udf->at) {
fprintf(gpoutfile, "gnuplot.y2_mapping = function(y) { return y; };");
fprintf(gpoutfile, " // replace returned value with %s\n",
axis_array[FIRST_Y_AXIS].link_udf->definition);
--
2.43.0
@@ -20,6 +20,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}/${PV}/${BP}.tar.gz;name=a
file://CVE-2025-31177.patch \
file://CVE-2025-31178.patch \
file://CVE-2025-31179.patch \
file://CVE-2025-31180.patch \
"
SRC_URI:append:class-target = " \
file://0002-do-not-build-demos.patch \