-
Notifications
You must be signed in to change notification settings - Fork 16.2k
fix: in GTK open dialog, do not preview huge files #31799
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
Conversation
Previewing images whose files are larger than a GB can crash Electron.
shell/browser/ui/file_dialog_gtk.cc
Outdated
// Setting an arbitrary filesize max t at 100 MB here. | ||
constexpr off_t ArbitraryMax = 100000000ULL; | ||
if (st.st_size >= ArbitraryMax) { | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit but we can probably just
return st.st_size < ArbitraryMax;
here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM. 9578048
Release Notes Persisted
|
I have automatically backported this PR to "14-x-y", please check out #31819 |
I have automatically backported this PR to "15-x-y", please check out #31820 |
I have automatically backported this PR to "16-x-y", please check out #31821 |
Description of Change
Fixes #31630.
Adds a size check to the image file before previewing it. I've set the cutoff at 100 MB since "100 MB ought to be enough for anybody" but if there's a strong use case for previewing 100 MB image files we could increase it.
CC @codebytere
Checklist
npm test
passesRelease Notes
Notes: Fixed crash in GTK open dialog when trying to preview huge image files.