Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System hang #43

Open
avaer opened this issue Apr 13, 2022 · 1 comment
Open

System hang #43

avaer opened this issue Apr 13, 2022 · 1 comment

Comments

@avaer
Copy link

avaer commented Apr 13, 2022

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

@avaer
Copy link
Author

avaer commented Apr 13, 2022

Might be related to #28.

Tested on 2.7.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant