commit 8934e0b37b40e1d764086ed7ad13e8ed61c8fea3
parent 33d7ef1e017b52a95d55887c05548b6207997b1c
Author: Mattias Andrée <maandree@kth.se>
Date: Tue, 10 Jan 2017 04:34:04 +0100
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:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git 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) {