diff options
author | Brian <brian@yutani.localnet.net> | 2007-04-19 14:15:11 -0600 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2007-04-19 14:15:11 -0600 |
commit | 020cdb47cf172c6ef8da78abcf6621233439d08b (patch) | |
tree | b73aecce4dd9171eff62efc16797cbe2d50d64be /src/mesa/shader/grammar | |
parent | 121f2212ccfa716e4853d0eead3755103d8c89e4 (diff) |
Fix valgrind problem caused by reading text[-1].
Diffstat (limited to 'src/mesa/shader/grammar')
-rw-r--r-- | src/mesa/shader/grammar/grammar.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mesa/shader/grammar/grammar.c b/src/mesa/shader/grammar/grammar.c index 989e954491..a9775961d3 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 */ |