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

NormalizeFile gives "Error: length=0; index=0" if quadrilateral has point outside of image edges #7

Closed
frenbergFNX opened this issue Jun 10, 2024 · 2 comments

Comments

@frenbergFNX
Copy link

We've had an issue with what I believe to be the code here in normalizeFile at line 175 which will throw an array index out of bounds error.
This seems to happen if we forexample have an image with dimensions 960x2080 and pass a quadrilatera with one point beeing located on the edge of the image ie at y value = 2080.
We can sanitize the input so its not a big deal but would be nice to have a proper return code for this. I think maybe we got "invalid quadrilateral" before we upgraded.

@xulihang
Copy link
Collaborator

Since it directly normalizes a file based on its path, I don't know its width and height so that I can make sure it is because of this problem. Is it necessary to return the "invalid quadrilateral" message? Does the current error message not suffice?

@frenbergFNX
Copy link
Author

It feels weird that we need code like this: "return valY >= photoHeight ? photoHeight - 1 : valY;" in onTouchMove (Notice the return of photopHeight - 1) but you are right, the error message doesn't matter so you can close this issue :)

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

2 participants