aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-02-12 21:01:36 +1300
committerDavid Phillips <david@sighup.nz>2017-02-12 21:03:54 +1300
commitc83eacc524ffd0cc3e93a2b88ea69e98c04859ec (patch)
treedba90507aba57889f8617c4eef6bcf53730ac267
parentc19cffcae57ff68d99eaa38f6d0547942dce5eca (diff)
downloadfractal-gen-opencl-c83eacc524ffd0cc3e93a2b88ea69e98c04859ec.tar.xz
Disallow negative sizes and iteration limits
Previously, we only checked for these valuse being zero, but not negative.
-rw-r--r--fractal-gen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fractal-gen.c b/fractal-gen.c
index 091f7d5..bfe151d 100644
--- a/fractal-gen.c
+++ b/fractal-gen.c
@@ -69,8 +69,8 @@ void die_help()
int main(int argc, char **argv)
{
- unsigned int size = 0;
- unsigned int iterations = 0;
+ long size = 0;
+ long iterations = 0;
char c = '\0';
while ((c = getopt(argc, argv, "s:i:")) != -1) {
@@ -88,7 +88,7 @@ int main(int argc, char **argv)
}
}
- if (size == 0 || iterations == 0) {
+ if (size <= 0 || iterations <= 0) {
die_help();
return 1; /* mostly unreachable */
}