Summary
Stack-use-after-return in parser_lex (prism.c:11876), mruby's prism parser. A pointer to a local stack variable (common_whitespace, used for tilde-heredoc dedent tracking) is stored on the heredoc's lex mode and later dereferenced after its owning stack frame has returned. This happens when nested heredocs with interpolation force the parser to recurse deeply enough that the original frame exits first.
Version
ac28f724bb6f34fb004e5da850e28d251f7761c0 — current master as of 2026-07-09
Build configuration
MRuby::Build.new do |conf|
conf.toolchain :clang
conf.gembox 'full-core'
conf.cc.defines << 'MRB_UTF8_STRING'
conf.cc.flags << %w(-fsanitize=address -fsanitize-address-use-after-return=always -g -O1)
conf.linker.flags << %w(-fsanitize=address)
Reproducer
(<<B
#{<<~B
#{)<<A}
A
poc.zip
ASAN Report
AddressSanitizer: stack-use-after-return on address 0x000107937380 at pc 0x000104b39b58 bp 0x00016b42dfd0 sp 0x00016b42dfc8
READ of size 8 at 0x000107937380 thread T0
#0 0x000104b39b54 in parser_lex prism.c:11876
#1 0x000104b64190 in parse_string_part prism.c:15394
#2 0x000104b4e404 in parse_expression_prefix prism.c:18073
#3 0x000104b42e54 in parse_expression prism.c:21588
#4 0x000104b4a69c in parse_expression_prefix prism.c:17576
#5 0x000104b42e54 in parse_expression prism.c:21588
#6 0x000104b39f18 in parse_statements prism.c:13187
#7 0x000104b1ddc4 in pm_parse prism.c:22293
#8 0x000104afecd0 in mrc_load_string_cxt compile.c:392
#9 0x000104b06b64 in parse_source mruby_compat.c:187
#10 0x000104b083d8 in mrb_load_detect_file_cxt mruby_compat.c:512
#11 0x0001049d15d8 in main mruby.c:357
#12 0x00018657bdfc in start+0x1b4c (dyld:arm64e+0x1fdfc)
Summary
Stack-use-after-return in parser_lex (prism.c:11876), mruby's prism parser. A pointer to a local stack variable (common_whitespace, used for tilde-heredoc dedent tracking) is stored on the heredoc's lex mode and later dereferenced after its owning stack frame has returned. This happens when nested heredocs with interpolation force the parser to recurse deeply enough that the original frame exits first.
Version
ac28f724bb6f34fb004e5da850e28d251f7761c0 — current master as of 2026-07-09
Build configuration
MRuby::Build.new do |conf|
conf.toolchain :clang
conf.gembox 'full-core'
conf.cc.defines << 'MRB_UTF8_STRING'
conf.cc.flags << %w(-fsanitize=address -fsanitize-address-use-after-return=always -g -O1)
conf.linker.flags << %w(-fsanitize=address)
Reproducer
(<<B
#{<<~B
#{)<<A}
A
poc.zip
ASAN Report
AddressSanitizer: stack-use-after-return on address 0x000107937380 at pc 0x000104b39b58 bp 0x00016b42dfd0 sp 0x00016b42dfc8
READ of size 8 at 0x000107937380 thread T0
#0 0x000104b39b54 in parser_lex prism.c:11876
#1 0x000104b64190 in parse_string_part prism.c:15394
#2 0x000104b4e404 in parse_expression_prefix prism.c:18073
#3 0x000104b42e54 in parse_expression prism.c:21588
#4 0x000104b4a69c in parse_expression_prefix prism.c:17576
#5 0x000104b42e54 in parse_expression prism.c:21588
#6 0x000104b39f18 in parse_statements prism.c:13187
#7 0x000104b1ddc4 in pm_parse prism.c:22293
#8 0x000104afecd0 in mrc_load_string_cxt compile.c:392
#9 0x000104b06b64 in parse_source mruby_compat.c:187
#10 0x000104b083d8 in mrb_load_detect_file_cxt mruby_compat.c:512
#11 0x0001049d15d8 in main mruby.c:357
#12 0x00018657bdfc in start+0x1b4c (dyld:arm64e+0x1fdfc)