Project

General

Profile

« Previous | Next » 

Revision 6beaf010

Added by mdalessio (Mike Dalessio) almost 2 years ago

[ruby/yarp] fix: binary CallNode with out-of-order arg and receiver

The snippet added in this commit previously resulted in a CallNode
with inverted start and end locations:

>   AssocNode(15...13)(
>     CallNode(15...13)(
        StringNode(15...17)((15...16), (16...16), (16...17), ""),
        nil,
        (12...13),
        nil,
        ArgumentsNode(12...13)([MissingNode(12...13)()]),
        nil,
        nil,
        0,
        "/"
      ),
      MissingNode(13...13)(),
      (13...13)
    ),

which failed an assertion during serialization.

After this change, it looks better:

>   AssocNode(12...13)(
>     CallNode(12...17)(
        StringNode(15...17)((15...16), (16...16), (16...17), ""),
        nil,
        (12...13),
        nil,
        ArgumentsNode(12...13)([MissingNode(12...13)()]),
        nil,
        nil,
        0,
        "/"
      ),
      MissingNode(13...13)(),
      (13...13)
    ),

Found by the fuzzer.

https://github.com/ruby/yarp/commit/040aa63ad6