X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fshader%2Fgrammar%2Fgrammar.c;h=a9775961d3a6577654cc072c8f3e423847e578e6;hb=61d3a66456852642ed8fdc1106dc0012e4b89779;hp=989e9544911688a8f2aa7a9d73772460bb54cfff;hpb=d23dd812ad597ddbe82be5f95708ece9ad63a2fa;p=mesa.git diff --git a/src/mesa/shader/grammar/grammar.c b/src/mesa/shader/grammar/grammar.c index 989e9544911..a9775961d3a 100644 --- a/src/mesa/shader/grammar/grammar.c +++ b/src/mesa/shader/grammar/grammar.c @@ -2693,14 +2693,16 @@ fast_match (dict *di, const byte *text, int *index, rule *ru, int *_PP, bytepool if (status == mr_matched) { - if (sp->m_emits != NULL) - if (emit_push (sp->m_emits, _BP->_F + _P, text[ind - 1], save_ind, &ctx)) + if (sp->m_emits != NULL) { + const byte ch = (ind <= 0) ? 0 : text[ind - 1]; + if (emit_push (sp->m_emits, _BP->_F + _P, ch, save_ind, &ctx)) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } - _P = _P2; + } + _P = _P2; } /* if the rule operator is a logical or, we pick up the first matching specifier */