diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-08-19 14:42:30 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-08-19 14:42:30 +0900 |
| commit | a117ec771b79819f42760c00e47a3616d5e67deb (patch) | |
| tree | f4afa89ff42020cb1c288a63678069c4eb8ca7f0 /src/debug.c | |
| parent | 834523945e9a74d1b23c6d792b1770195636af42 (diff) | |
| download | mruby-a117ec771b79819f42760c00e47a3616d5e67deb.tar.gz mruby-a117ec771b79819f42760c00e47a3616d5e67deb.zip | |
Remove mixed signed/unsigned comparison in debug.c.
Diffstat (limited to 'src/debug.c')
| -rw-r--r-- | src/debug.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/debug.c b/src/debug.c index 7c04ad148..e55f11d4f 100644 --- a/src/debug.c +++ b/src/debug.c @@ -53,10 +53,10 @@ select_line_type(const uint16_t *lines, size_t lines_len) MRB_API char const* mrb_debug_get_filename(mrb_irep *irep, ptrdiff_t pc) { - if (irep && pc < irep->ilen) { + if (irep && pc >= 0 && pc < irep->ilen) { mrb_irep_debug_info_file* f = NULL; if (!irep->debug_info) { return irep->filename; } - else if ((f = get_file(irep->debug_info, pc))) { + else if ((f = get_file(irep->debug_info, (uint32_t)pc))) { return f->filename; } } @@ -66,12 +66,12 @@ mrb_debug_get_filename(mrb_irep *irep, ptrdiff_t pc) MRB_API int32_t mrb_debug_get_line(mrb_irep *irep, ptrdiff_t pc) { - if (irep && pc < irep->ilen) { + if (irep && pc >= 0 && pc < irep->ilen) { mrb_irep_debug_info_file* f = NULL; if (!irep->debug_info) { return irep->lines? irep->lines[pc] : -1; } - else if ((f = get_file(irep->debug_info, pc))) { + else if ((f = get_file(irep->debug_info, (uint32_t)pc))) { switch (f->line_type) { case mrb_debug_line_ary: mrb_assert(f->start_pos <= pc && pc < (f->start_pos + f->line_entry_count)); |
