GNOME Bugzilla – Bug 21028
should warn user about enormous memory consumption
Last modified: 2003-12-08 21:53:11 UTC
Package: gimp Version: 1.1.24 Name........: Danny Tholen Email.......: dannyt@sci.kun.nl Platform....: AMD k6-2 350MHz, 128MB, Maxtor 7.5 GB 7200rpm, Mandrake 7.0 (kernel 2.2.16) GIMP Version: 1.1.24 GTK Version.: 1.2.8 WM/Version..: kde 1.1.2 -- Other system notes: -- -- Problem description: When trying to resize an image I changed in the 'scale image' menu the ratio X and ratio Y to 25.0000. Actually I meant 0.25 but well, sometimes you don't pay attention:) The image was already big (1468*3000 pixels) and this ofcourse would take some calculations. But that it just kept swallowing more CPU time while the harddisk was making an amazing amount of noise ;) didn't sound very good to me. After a time even the mouse stopped working, and I couldn't do a normal reboot. So I decided to hit the reset button after 45 min or so. I found that a -rw------- 1 danny danny 190644224 Aug 15 21:24 gimpswap.8967h was created which was 20k short of my entire free space on that partition. I think might be good to check whether a users command is not taking the system down. It shouldn't be able to slow down the machine that much. -- -- How to repeat: just scale a picture to insane amounts i guess. -- -- Other comments: wonder if i can use this as a sort of DoS attack *grin* -- ------- Bug moved to this database by debbugs-export@bugzilla.gnome.org 2001-01-28 10:57 ------- This bug was previously known as bug 21028 at http://bugs.gnome.org/ http://bugs.gnome.org/show_bug.cgi?id=21028 Originally filed under the gimp product and general component. The original reporter (dannyt@sci.kun.nl) of this bug does not have an account here. Reassigning to the exporter, debbugs-export@bugzilla.gnome.org. Reassigning to the default owner of the component, egger@suse.de.
The preferences dialog already contains a "Maximum Image Size" option that triggers a warning if the user tries to create a new image that is too large. The same value could be also tested when the user wants to scale or resize the image. In some cases, the current image will already be larger than the threshold that generates a warning, and the user will probably not want to see a warning dialog popping up after every resize. So a better solution would be something like this: ... if ((new_image_size > 2 * current_image_size) && (new_image_size > max_new_image_size)) { resize_confirm_dialog (...); } ...
Re-assigning all Gimp bugs to default component owner (Gimp bugs list)
Can we fix this for 1.2.3?
Well yes, of course we can fix this for 1.2.3 if someone comes up with a small and clean patch. This will probably add a few new strings that need to be translated, so it shouldn't happen too close to a release.
Setting target milestone to 1.2.4. Perhaps someone wants to come up with a patch...
Here's a patch to get us started with. I wouldn't call this a clean patch but it is implemented along the uglyness of the current code... This patch does not address the problem of the user trying to scale layers to insane sizes.
Created attachment 7682 [details] [review] a first attempt to address the problem
It's been over a year since the patch was attached, with no follow-ups. Can it be applied as-is? If not, I suggest bumping to 1.2.5, or declaring WONTFIX. Dave.
I don't like the patch although I wrote it. Postponing to 1.2.5.
Moving to 1.2.6 milestone, since it is looking like there will be a pretty quick 1.2.( release.
Setting milestone to 1.3.x, as per comments added to bug #78064. Dave.
Created attachment 22196 [details] [review] Patch against CVS
Like Sven, I'm not too happy with this patch - there's lots of repeated code that could be shared. A little bit of cleaning up should make it sufficient, though. I would suggest modifying gimp_image_check_scaling so that it's a boolean rather than an action verb (something like gimp_image_is_bad_scaling, except better). Dave.
After talking to mitch, here's the plan... gimp_image_scale_check () should return an enum which has the possible values GIMP_IMAGE_SCALE_OK, GIMP_IMAGE_SCALE_TOO_SMALL and GIMP_IMAGE_SCALE_TOO_BIG. The result would then be used in a switch. Ideally, TOO_SMALL and TOO_BIG would share the same GUI code, and just change the message used. Cheers, Dave.
Fixed in CVS. Not going to be fixed in 1.2. 2003-12-08 Dave Neary <bolsh@gimp.org> * app/core/core-enums.h: * app/core/gimpimage-scale.[ch]: Added the GimpImageScaleCheckType enum and used it in gimp_image_scale_check() which used to be gimp_image_check_scaling(). * app/gui/image_commands.c: Used the above when checking scaling parameters to display a message if the image is too big or too small after scaling. Closes bug #21028.