Skip to content

[Bug] Unable to parse BYML that include recursive nodes #4

Description

@Antonio225t

First off I wanted to say that this is a very good library for handling BYML files but there's an issue that this resource explains:

Note: a BYAML file may contain cycles. This means that an array or dictionary may contain a node that the parser has seen earlier. Because of this, parsers must be careful not to end up in an infinite loop.

Sadly this library does not take into account this and crashes with a stack overflow error when trying to open EnterCatMarioStageMap.byml in Super Mario 3D World + Bowser's Fury...

This is the stack trace:

[... a lot more]
   at BymlLibrary.Nodes.Immutable.Containers.ImmutableBymlMap.ToMutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromImmutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Nodes.Immutable.Containers.ImmutableBymlMap.ToMutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromImmutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Nodes.Immutable.Containers.ImmutableBymlArray.ToMutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromImmutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Nodes.Immutable.Containers.ImmutableBymlMap.ToMutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromImmutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Nodes.Immutable.Containers.ImmutableBymlMap.ToMutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromImmutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Nodes.Immutable.Containers.ImmutableBymlArray.ToMutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromImmutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Nodes.Immutable.Containers.ImmutableBymlMap.ToMutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromImmutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Nodes.Immutable.Containers.ImmutableBymlMap.ToMutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromImmutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Nodes.Immutable.Containers.ImmutableBymlArray.ToMutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromImmutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Nodes.Immutable.Containers.ImmutableBymlMap.ToMutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromImmutable(Revrs.RevrsReader, BymlLibrary.ImmutableByml ByRef, BymlLibrary.ImmutableByml ByRef)
   at BymlLibrary.Byml.FromBinary(System.Span`1<Byte>, Revrs.Endianness ByRef, UInt16 ByRef)
   at BymlLibrary.Byml.FromBinary(System.Span`1<Byte>)

I hope this gets fixed!
Also, this is unrelated but I'd like to know why this library does not support BYML V1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions