Skip to content
  • Yusuke Endoh's avatar
    75acbd5f
    compile.c: avoid newarraykwsplat for arguments · 75acbd5f
    Yusuke Endoh authored
    `foo(*rest, post, **empty_kw)` is compiled like
    `foo(*rest + [post, **empty_kw])`, and `**empty_kw` is removed by
    "newarraykwsplat" instruction.
    However, the method call still has a flag of KW_SPLAT, so "post" is
    considered as a keyword hash, which caused a segfault.
    Note that the flag cannot be removed if "empty_kw" is not always empty.
    
    This change fixes the issue by compiling arguments with "newarray"
    instead of "newarraykwsplat".
    
    [Bug #16442]
    75acbd5f
    compile.c: avoid newarraykwsplat for arguments
    Yusuke Endoh authored
    `foo(*rest, post, **empty_kw)` is compiled like
    `foo(*rest + [post, **empty_kw])`, and `**empty_kw` is removed by
    "newarraykwsplat" instruction.
    However, the method call still has a flag of KW_SPLAT, so "post" is
    considered as a keyword hash, which caused a segfault.
    Note that the flag cannot be removed if "empty_kw" is not always empty.
    
    This change fixes the issue by compiling arguments with "newarray"
    instead of "newarraykwsplat".
    
    [Bug #16442]
Loading