diff options
author | Peter Zhu <peter@peterzhu.ca> | 2024-01-17 11:50:40 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2024-01-17 15:51:44 -0500 |
commit | a6e924cf5f67368b49d5745f5cae22bc68ef21a1 (patch) | |
tree | 4685da26eb59a58caf7b264f8ac902e7e0a2a497 /iseq.c | |
parent | b0a32b724971c5113c02946b1b959c1d73a9e256 (diff) | |
download | ruby-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.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -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; |