X Tutup
Skip to content

System hang #43

@avaer

Description

@avaer

This repro will completely hang the library until it crashes:

const maxRectsPacker = new MaxRectsPacker(512, 512, {
          padding: 1,
          // exclusiveTag: false,
        });
        const rects2 = [
          {
            width: 512,
            height: 512,
          },
          {
            width: 512,
            height: 512,
          },
        ];
        for (const rect of rects2) {
          maxRectsPacker.add(rect);  
        }

As far as I understand, this should set oversized flags but bail out. Instead it just loops forever doing some sort of placement/freeing procedure.

This makes the library dangerous to use in any situation where the input sizes can be user-controlled, since it risks total application hang.

If you pause you can get a sense of the infinite loop.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup