From 9b55dbc1c8ce65819ea7069525cdb804e21419c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Thu, 20 Jun 2024 11:35:02 +0200 Subject: [PATCH] Fix off-by-one error for newblock allocation in dlist_alloc Resolves: https://issues.redhat.com/browse/RHEL-40566 --- ...one-for-newblock-allocation-in-dlist.patch | 28 +++++++++++++++++++ mesa.spec | 9 +++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 0001-mesa-fix-off-by-one-for-newblock-allocation-in-dlist.patch diff --git a/0001-mesa-fix-off-by-one-for-newblock-allocation-in-dlist.patch b/0001-mesa-fix-off-by-one-for-newblock-allocation-in-dlist.patch new file mode 100644 index 0000000..6862136 --- /dev/null +++ b/0001-mesa-fix-off-by-one-for-newblock-allocation-in-dlist.patch @@ -0,0 +1,28 @@ +From 460d2c46a903fed295a1528c8b6273dd6b0e0d19 Mon Sep 17 00:00:00 2001 +From: thfrwn <11335318+rfht@users.noreply.github.com> +Date: Fri, 9 Feb 2024 17:00:55 -0500 +Subject: [PATCH] mesa: fix off-by-one for newblock allocation in dlist_alloc + +Cc: mesa-stable +Reviewed-by: Pierre-Eric Pelloux-Prayer +Part-of: +--- + src/mesa/main/dlist.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c +index b0184a24e20..9213641699a 100644 +--- a/src/mesa/main/dlist.c ++++ b/src/mesa/main/dlist.c +@@ -1220,7 +1220,7 @@ dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes, bool align8) + ctx->ListState.CurrentPos++; + } + +- if (ctx->ListState.CurrentPos + numNodes + contNodes > BLOCK_SIZE) { ++ if (ctx->ListState.CurrentPos + numNodes + contNodes >= BLOCK_SIZE) { + /* This block is full. Allocate a new block and chain to it */ + Node *newblock; + Node *n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; +-- +2.45.2 + diff --git a/mesa.spec b/mesa.spec index 6896216..eae5fe0 100644 --- a/mesa.spec +++ b/mesa.spec @@ -38,7 +38,7 @@ Name: mesa Summary: Mesa graphics libraries Version: 23.1.4 -Release: 2%{?rctag:.%{rctag}}%{?dist} +Release: 3%{?rctag:.%{rctag}}%{?dist} License: MIT URL: http://www.mesa3d.org @@ -66,6 +66,9 @@ Patch12: radeonsi-turn-off-glthread.patch Patch13: 0001-llvmpipe-only-include-old-Transform-includes-when-ne.patch Patch14: 0001-clover-llvm-move-to-modern-pass-manager.patch +# https://issues.redhat.com/browse/RHEL-40566 +Patch15: 0001-mesa-fix-off-by-one-for-newblock-allocation-in-dlist.patch + BuildRequires: gcc BuildRequires: gcc-c++ @@ -587,6 +590,10 @@ done %endif %changelog +* Thu Jun 20 2024 José Expósito - 23.1.4-3 +- Fix off-by-one error for newblock allocation in dlist_alloc + Resolves: https://issues.redhat.com/browse/RHEL-40566 + * Thu Nov 23 2023 José Expósito - 23.1.4-2 - Rebuild against LLVM 17