mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
glsl: Fix memory error when creating the supported version string.
Passing ralloc_vasprintf_append a 0-byte allocation doesn't work. If passed a non-NULL argument, ralloc calls strlen to find the end of the string. Since there's no terminating '\0', it runs off the end. Fixes a crash introduced in14880a510a. (cherry-picked from commita7d350790b)
This commit is contained in:
parent
c66ffcf663
commit
9286d0ddd3
1 changed files with 1 additions and 1 deletions
|
|
@ -97,7 +97,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
|
|||
? 100 : 110;
|
||||
const unsigned highest_version =
|
||||
(ctx->API == API_OPENGL) ? ctx->Const.GLSLVersion : 100;
|
||||
char *supported = (char *) ralloc_context(this);
|
||||
char *supported = ralloc_strdup(this, "");
|
||||
|
||||
for (unsigned ver = lowest_version; ver <= highest_version; ver += 10) {
|
||||
const char *const prefix = (ver == lowest_version)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue