summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-10 09:29:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-10 09:29:00 +0000
commit67099c45057ca72c48ee14960b9be1be6634b85b (patch)
tree05650f65aeb3b3877c192cde6e3aead77fef381d /compile.c
parent9dd8c528d80e917209fe4a951614b47ab5aabcf4 (diff)
Fix potential NULL pointer access [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 1d2c603f42..7d1ee0fadd 100644
--- a/compile.c
+++ b/compile.c
@@ -1406,6 +1406,7 @@ static int
get_dyna_var_idx(const rb_iseq_t *iseq, ID id, int *level, int *ls)
{
int lv = 0, idx = -1;
+ const rb_iseq_t *const topmost_iseq = iseq;
while (iseq) {
idx = get_dyna_var_idx_at_raw(iseq, id);
@@ -1417,7 +1418,7 @@ get_dyna_var_idx(const rb_iseq_t *iseq, ID id, int *level, int *ls)
}
if (idx < 0) {
- COMPILE_ERROR(iseq, ISEQ_LAST_LINE(iseq),
+ COMPILE_ERROR(topmost_iseq, ISEQ_LAST_LINE(topmost_iseq),
"get_dyna_var_idx: -1");
}