diff options
| author | Yusuke Endoh <mame@ruby-lang.org> | 2022-01-04 23:18:34 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2022-01-04 23:18:37 +0900 |
| commit | e9a4cc02b491fc8a2936f51b9f94ddcd77dd67f7 (patch) | |
| tree | 144076b345bf9b9dfd895a53b67dcd6ebac859d6 /include/ruby/thread.h | |
| parent | 11b1ebe606a82bcdcb4ff5568f0302c5470d0048 (diff) | |
[ruby/error_highlight] Add a test to check if it is robust against a spoofed filename
Previously, RubyVM::AST.of opened a wrong file if the iseq's file path is spoofed.
```
module Dummy
binding.irb
end
```
```
$ ruby test.rb
From: test.rb @ line 2 :
1: module Dummy
=> 2: binding.irb
3: end
irb(Dummy):001:0> foo
/home/mame/work/ruby/local/lib/ruby/3.1.0/error_highlight/base.rb:412:in `spot_colon2': undefined method `last_lineno' for nil:NilClass (NoMethodError)
if nd_parent.last_lineno == @node.last_lineno
^^^^^^^^^^^^
```
Found by @kateinoigakukun
This issue is already fixed in the interpreter side.
This change just adds a test for the case.
https://github.com/ruby/error_highlight/commit/f3626b9032
Diffstat (limited to 'include/ruby/thread.h')
0 files changed, 0 insertions, 0 deletions
