app/gimage_cmds.c guard against NaN and infinity. There are pics out there

* app/gimage_cmds.c
* tools/pdbgen/pdb/gimage.pdb: (gimp_image_set_resolution) guard
  against NaN and infinity. There are pics out there using these
  values and it seems that NaN > GIMP_MIN_RESOLUTION. Fixes #8476.


--Sven
This commit is contained in:
Sven Neumann 2000-04-06 01:01:31 +00:00
parent 743516bfb0
commit 56f1372519
7 changed files with 226 additions and 181 deletions

View File

@ -1,3 +1,10 @@
2000-04-06 Sven Neumann <sven@gimp.org>
* app/gimage_cmds.c
* tools/pdbgen/pdb/gimage.pdb: (gimp_image_set_resolution) guard
against NaN and infinity. There are pics out there using these
values and it seems that NaN > GIMP_MIN_RESOLUTION. Fixes #8476.
2000-04-06 Sven Neumann <sven@gimp.org>
* app/app_procs.c: if we cannot load the font we'd like to use,

View File

@ -20,6 +20,9 @@
#include "procedural_db.h"
#include "config.h"
#include <math.h>
#include <string.h>
#include "apptypes.h"
@ -32,6 +35,7 @@
#include "layer.h"
#include "layer_pvt.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
static ProcRecord image_list_proc;
@ -3451,9 +3455,15 @@ image_set_resolution_invoker (Argument *args)
if (success)
{
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
success = FALSE;
if (isnan (xresolution) || xresolution < GIMP_MIN_RESOLUTION ||
isinf (xresolution) || xresolution > GIMP_MAX_RESOLUTION ||
isnan (yresolution) || yresolution < GIMP_MIN_RESOLUTION ||
isinf (yresolution) || yresolution > GIMP_MAX_RESOLUTION)
{
g_message (_("Image resolution is out of bounds,\n"
"using the default resolution instead."));
success = FALSE;
}
else
{
gimage->xresolution = xresolution;

View File

@ -1,3 +1,8 @@
2000-04-06 Sven Neumann <sven@gimp.org>
* POTFILES.in: added gimage_cmds.c
* de.po: updated german translation
2000-04-05 Gert Dewit <Gert.Dewit@sos.be>
* nl.po: First 1.1 (and 1.2) Dutch translation effort

View File

@ -43,6 +43,7 @@ app/fuzzy_select.c
app/gdisplay.c
app/gdisplay_color_ui.c
app/gdisplay_ops.c
app/gimage_cmds.c
app/gimage_mask.c
app/gimpbrush.c
app/gimpbrushlist.c

348
po/de.po

File diff suppressed because it is too large Load Diff

View File

@ -1212,9 +1212,15 @@ HELP
$invoke{code} = <<'CODE';
{
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
success = FALSE;
if (isnan (xresolution) || xresolution < GIMP_MIN_RESOLUTION ||
isinf (xresolution) || xresolution > GIMP_MAX_RESOLUTION ||
isnan (yresolution) || yresolution < GIMP_MIN_RESOLUTION ||
isinf (yresolution) || yresolution > GIMP_MAX_RESOLUTION)
{
g_message (_("Image resolution is out of bounds,\n"
"using the default resolution instead."));
success = FALSE;
}
else
{
gimage->xresolution = xresolution;
@ -1417,7 +1423,8 @@ CODE
}
@headers = qw(<string.h> "gimage.h" "libgimp/gimplimits.h");
@headers = qw("config.h" <string.h> <math.h> "gimage.h"
"libgimp/gimpintl.h" "libgimp/gimplimits.h");
$extra{app}->{code} = <<'CODE';
/* Yuup, this is somewhat unsmooth, to say the least */

View File

@ -1212,9 +1212,15 @@ HELP
$invoke{code} = <<'CODE';
{
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
success = FALSE;
if (isnan (xresolution) || xresolution < GIMP_MIN_RESOLUTION ||
isinf (xresolution) || xresolution > GIMP_MAX_RESOLUTION ||
isnan (yresolution) || yresolution < GIMP_MIN_RESOLUTION ||
isinf (yresolution) || yresolution > GIMP_MAX_RESOLUTION)
{
g_message (_("Image resolution is out of bounds,\n"
"using the default resolution instead."));
success = FALSE;
}
else
{
gimage->xresolution = xresolution;
@ -1417,7 +1423,8 @@ CODE
}
@headers = qw(<string.h> "gimage.h" "libgimp/gimplimits.h");
@headers = qw("config.h" <string.h> <math.h> "gimage.h"
"libgimp/gimpintl.h" "libgimp/gimplimits.h");
$extra{app}->{code} = <<'CODE';
/* Yuup, this is somewhat unsmooth, to say the least */