aboutsummaryrefslogtreecommitdiffstats
path: root/iseq.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2024-01-17 11:50:40 -0500
committerPeter Zhu <peter@peterzhu.ca>2024-01-17 15:51:44 -0500
commita6e924cf5f67368b49d5745f5cae22bc68ef21a1 (patch)
tree4685da26eb59a58caf7b264f8ac902e7e0a2a497 /iseq.c
parentb0a32b724971c5113c02946b1b959c1d73a9e256 (diff)
downloadruby-a6e924cf5f67368b49d5745f5cae22bc68ef21a1.tar.gz
[PRISM] Fix crash in compile_prism
If the argument is not a file or a string, it assumes it's a string which will crash because RSTRING_PTR and RSTRING_LEN assumes it's a string.
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/iseq.c b/iseq.c
index 28c2d4f80b..4f1c39d2ae 100644
--- a/iseq.c
+++ b/iseq.c
@@ -1485,6 +1485,7 @@ iseqw_s_compile_prism(int argc, VALUE *argv, VALUE self)
pm_string_mapped_init(&input, RSTRING_PTR(file));
}
else {
+ Check_Type(src, T_STRING);
input.source = (const uint8_t *)RSTRING_PTR(src);
input.length = RSTRING_LEN(src);
input.type = PM_STRING_SHARED;