From 59376beeb02b68180ee3d7d216ab67ef8eb40266 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 14 Feb 2012 11:34:25 +0100 Subject: Fix wrong address access and skip till first valid header --- src/ufodecode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/ufodecode.c') diff --git a/src/ufodecode.c b/src/ufodecode.c index 776cc61..1cdb1db 100644 --- a/src/ufodecode.c +++ b/src/ufodecode.c @@ -315,7 +315,7 @@ size_t ufo_decoder_decode_frame(ufo_decoder decoder, uint32_t *raw, size_t advance; const size_t num_words = num_bytes / 4; - if ((pixels == NULL)||(num_words < 16)) + if ((pixels == NULL) || (num_words < 16)) return 0; #ifdef CHECKS @@ -401,7 +401,10 @@ int ufo_decoder_get_next_frame(ufo_decoder decoder, uint16_t **pixels, uint32_t return ENOMEM; } - advance = ufo_decoder_decode_frame(decoder, raw + pos * 4, decoder->num_bytes - pos * 4, *pixels, frame_number, time_stamp, cmask); + while (raw[pos] != 0x51111111) + pos++; + + advance = ufo_decoder_decode_frame(decoder, raw + pos, decoder->num_bytes - pos, *pixels, frame_number, time_stamp, cmask); if (!advance) return EILSEQ; -- cgit v1.2.3