From 8934e0b37b40e1d764086ed7ad13e8ed61c8fea3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 10 Jan 2017 04:34:04 +0100 Subject: Check that the width and height are non-zero, to avoid division by zero error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/stream.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/stream.c') 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) { -- cgit v1.2.3-70-g09d2