From e886ee02eddc0454dd484405db6c9a2e879f33f8 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: (cherry picked from commit 460d2c46a903fed295a1528c8b6273dd6b0e0d19) --- .pick_status.json | 2 +- src/mesa/main/dlist.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index a625bf9f39a..b26eda71661 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -54,7 +54,7 @@ "description": "mesa: fix off-by-one for newblock allocation in dlist_alloc", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 63feef2b097..8c32ed80d79 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;