Bug 704833: Fix div by zero when resolution is set to zero.
authorSebastian Rasmussen <[email protected]>
Mon, 10 Oct 2022 16:39:18 +0000 (18:39 +0200)
committerSebastian Rasmussen <[email protected]>
Mon, 10 Oct 2022 16:51:46 +0000 (18:51 +0200)
Take the opportunity to handle negative resolutions the same way.

source/tools/muraster.c

index 02d2d5ba2f1433d7e0f164b3be671278f5c4ff26..ee44ee778f75c12409afb545301dcbf7e1bd2548 100644 (file)
@@ -1421,6 +1421,13 @@ read_resolution(const char *arg)
                y_resolution = fz_atoi(arg);
        else
                y_resolution = x_resolution;
+
+       if (x_resolution <= 0 || y_resolution <= 0)
+       {
+               fprintf(stderr, "Ignoring invalid resolution\n");
+               x_resolution =  X_RESOLUTION;
+               y_resolution =  Y_RESOLUTION;
+       }
 }
 
 static int