diff options
author | David Phillips <david@sighup.nz> | 2017-02-12 21:01:36 +1300 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2017-02-12 21:03:54 +1300 |
commit | c83eacc524ffd0cc3e93a2b88ea69e98c04859ec (patch) | |
tree | dba90507aba57889f8617c4eef6bcf53730ac267 | |
parent | c19cffcae57ff68d99eaa38f6d0547942dce5eca (diff) | |
download | fractal-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.c | 6 |
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 */ } |