diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_ffrecord.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index 3c4d4eb5..edbf13cc 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c | |||
| @@ -854,7 +854,7 @@ static void LJ_FASTCALL recff_string_range(jit_State *J, RecordFFData *rd) | |||
| 854 | } | 854 | } |
| 855 | trstart = recff_string_start(J, str, &start, trstart, trlen, tr0); | 855 | trstart = recff_string_start(J, str, &start, trstart, trlen, tr0); |
| 856 | if (rd->data) { /* Return string.sub result. */ | 856 | if (rd->data) { /* Return string.sub result. */ |
| 857 | if (end - start >= 0) { | 857 | if (start <= end) { |
| 858 | /* Also handle empty range here, to avoid extra traces. */ | 858 | /* Also handle empty range here, to avoid extra traces. */ |
| 859 | TRef trptr, trslen = emitir(IRTGI(IR_SUBOV), trend, trstart); | 859 | TRef trptr, trslen = emitir(IRTGI(IR_SUBOV), trend, trstart); |
| 860 | emitir(IRTGI(IR_GE), trslen, tr0); | 860 | emitir(IRTGI(IR_GE), trslen, tr0); |
| @@ -865,8 +865,8 @@ static void LJ_FASTCALL recff_string_range(jit_State *J, RecordFFData *rd) | |||
| 865 | J->base[0] = lj_ir_kstr(J, &J2G(J)->strempty); | 865 | J->base[0] = lj_ir_kstr(J, &J2G(J)->strempty); |
| 866 | } | 866 | } |
| 867 | } else { /* Return string.byte result(s). */ | 867 | } else { /* Return string.byte result(s). */ |
| 868 | ptrdiff_t i, len = end - start; | 868 | if (start < end) { |
| 869 | if (len > 0) { | 869 | ptrdiff_t i, len = end - start; |
| 870 | TRef trslen = emitir(IRTGI(IR_SUBOV), trend, trstart); | 870 | TRef trslen = emitir(IRTGI(IR_SUBOV), trend, trstart); |
| 871 | emitir(IRTGI(IR_EQ), trslen, lj_ir_kint(J, (int32_t)len)); | 871 | emitir(IRTGI(IR_EQ), trslen, lj_ir_kint(J, (int32_t)len)); |
| 872 | if (J->baseslot + len > LJ_MAX_JSLOTS) | 872 | if (J->baseslot + len > LJ_MAX_JSLOTS) |
