Fix off-by-one error for newblock allocation in dlist_alloc

Resolves: https://issues.redhat.com/browse/RHEL-40566
This commit is contained in:
José Expósito 2024-06-20 11:35:02 +02:00
parent b386b2045c
commit 9b55dbc1c8
2 changed files with 36 additions and 1 deletions

View File

@ -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 <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27556>
---
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

View File

@ -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 <jexposit@redhat.com> - 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 <jexposit@redhat.com> - 23.1.4-2
- Rebuild against LLVM 17