From 508435541810172d1e6d3d684e1e081096233d97 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Thu, 29 Sep 2016 08:33:14 +0200 Subject: Do not attempt decoding if no more data left --- src/ufodecode.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ufodecode.c') diff --git a/src/ufodecode.c b/src/ufodecode.c index 6a90a54..a00ac9f 100644 --- a/src/ufodecode.c +++ b/src/ufodecode.c @@ -548,6 +548,11 @@ ufo_decoder_get_next_frame (UfoDecoder *decoder, uint16_t **pixels, UfoDecoderMe ((raw[pos] & 0xFFFFFFF0) != 0x51111110)) /* we can only match the first part */ pos++; + /* before even attempting to decode the non-existent frame, bail out */ + if (pos == num_words) { + return EIO; + } + advance = ufo_decoder_decode_frame (decoder, raw + pos, decoder->num_bytes - pos, *pixels, meta); /* -- cgit v1.2.3