aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-01-10 04:34:04 +0100
committerMattias Andrée <maandree@kth.se>2017-01-10 04:34:04 +0100
commit8934e0b37b40e1d764086ed7ad13e8ed61c8fea3 (patch)
tree34e658fccb6a263da639ee491b05474fc7a6bd50 /src
parentvu-repeat: add option to repeat ad infinitum (diff)
downloadblind-8934e0b37b40e1d764086ed7ad13e8ed61c8fea3.tar.gz
blind-8934e0b37b40e1d764086ed7ad13e8ed61c8fea3.tar.bz2
blind-8934e0b37b40e1d764086ed7ad13e8ed61c8fea3.tar.xz
Check that the width and height are non-zero, to avoid division by zero error
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/stream.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/stream.c b/src/stream.c
index 86813e6..e99d003 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -64,6 +64,11 @@ eninit_stream(int status, struct stream *stream)
if (errno || *end)
goto bad_format;
+ if (!stream->width)
+ eprintf("%s: width is zero\n", stream->file);
+ if (!stream->height)
+ eprintf("%s: height is zero\n", stream->file);
+
n = (size_t)(p - stream->buf) + 1;
memmove(stream->buf, stream->buf + n, stream->ptr -= n);
while (stream->ptr < 5) {