diff options
| author | Mike Pall <mike> | 2019-12-21 13:52:47 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2019-12-21 13:52:47 +0100 |
| commit | 0bee44c9dc9bee64d1143aa0febd2b61819d35bd (patch) | |
| tree | 0ff5503252eb488f9c7f39109864bf301ba49696 /src | |
| parent | bd00094c3b50e193fb32aad79b7ea8ea6b78ed25 (diff) | |
| download | luajit-0bee44c9dc9bee64d1143aa0febd2b61819d35bd.tar.gz luajit-0bee44c9dc9bee64d1143aa0febd2b61819d35bd.tar.bz2 luajit-0bee44c9dc9bee64d1143aa0febd2b61819d35bd.zip | |
Properly fix pointer diff in string.find().
Thanks to Vyacheslav Egorov.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_ffrecord.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index cb374beb..c673d650 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c | |||
| @@ -949,8 +949,8 @@ static void LJ_FASTCALL recff_string_find(jit_State *J, RecordFFData *rd) | |||
| 949 | str->len-(MSize)start, pat->len)) { | 949 | str->len-(MSize)start, pat->len)) { |
| 950 | TRef pos; | 950 | TRef pos; |
| 951 | emitir(IRTG(IR_NE, IRT_PGC), tr, trp0); | 951 | emitir(IRTG(IR_NE, IRT_PGC), tr, trp0); |
| 952 | /* Don't use STRREF of trstr. We need a pointer diff. */ | 952 | /* Recompute offset. trsptr may not point into trstr after folding. */ |
| 953 | pos = emitir(IRTI(IR_SUB), emitir(IRTI(IR_SUB), tr, trstr), lj_ir_kint(J, sizeof(GCstr))); | 953 | pos = emitir(IRTI(IR_ADD), emitir(IRTI(IR_SUB), tr, trsptr), trstart); |
| 954 | J->base[0] = emitir(IRTI(IR_ADD), pos, lj_ir_kint(J, 1)); | 954 | J->base[0] = emitir(IRTI(IR_ADD), pos, lj_ir_kint(J, 1)); |
| 955 | J->base[1] = emitir(IRTI(IR_ADD), pos, trplen); | 955 | J->base[1] = emitir(IRTI(IR_ADD), pos, trplen); |
| 956 | rd->nres = 2; | 956 | rd->nres = 2; |
