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

rescale() crashes if given negative w / h values #20

Open
fire-eggs opened this issue Oct 4, 2021 · 5 comments
Open

rescale() crashes if given negative w / h values #20

fire-eggs opened this issue Oct 4, 2021 · 5 comments
Assignees
Labels

Comments

@fire-eggs
Copy link

In YAIV, inadvertently trying to zoom below 0%. This caused negative w or h values being sent to fl_imgtk::rescale.

Resulted in a crash rather than the expected nullptr return.

@rageworx
Copy link
Owner

rageworx commented Nov 20, 2021

Dear Kevin,
I'd seen this issue too late, sorry.
I will try to check that issue, anyway did you know rescale parameters are only "unsigned" ?
I think zero size may protect by this line.

if ( ( img != NULL ) && ( w > 0 ) && ( h > 0 ) )

You mean below 0%, is it going to negative value as integer ?
Maybe you didn't check signed to unsigned value, it may be a reason of crash for too large image size.
Regards, Raph.

@rageworx
Copy link
Owner

Maybe ... is it better if limit maximum size of resized ?
Like ... #define MAX_IMAGE_WH_SIZE 1024000 ?

@fire-eggs
Copy link
Author

I'd seen this issue too late, sorry.

Not a crisis, just informational. A flaw in my UI, incorrectly sending a signed int to the resize function.

Glad to see you're still about - hadn't heard from you for a while ...

@rageworx
Copy link
Owner

New project almost reached to the end for now.
So I couldn't have make time for response for a while.
Thanks !

@rageworx
Copy link
Owner

Need to overflow case to prevent failure case.

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

No branches or pull requests

2 participants