Skip to content

fix off-by-one for newblock allocation in dlist_alloc

Thomas Frohwein requested to merge thfr/mesa:main into main

What does this MR do and why?

Fix an off-by-one in the condition for allocation of a new block in dist_alloc. This was noticed on OpenBSD when running software that makes heavy use of display lists. With this diff applied, no more SEGV_MAPERR occur. Rationale: as ctx->ListState.CurrentPos is zero-based, a new block should be allocated already when ctx->ListState.CurrentPos + numNodes + contNodes is equal to to or greater than BLOCK_SIZE.

Original OpenBSD report with backtraces: https://marc.info/?l=openbsd-ports&m=170709003327657&w=2

Merge request reports