summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2012-02-14 11:34:25 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2012-02-14 11:34:25 +0100
commit59376beeb02b68180ee3d7d216ab67ef8eb40266 (patch)
treee0f4b17f408cc99506ce8e2047bc5ff8a5450f4b
parent54d61744939cb79eb2453b6a9e896b34e7701b55 (diff)
downloadufodecode-59376beeb02b68180ee3d7d216ab67ef8eb40266.tar.gz
ufodecode-59376beeb02b68180ee3d7d216ab67ef8eb40266.tar.bz2
ufodecode-59376beeb02b68180ee3d7d216ab67ef8eb40266.tar.xz
ufodecode-59376beeb02b68180ee3d7d216ab67ef8eb40266.zip
Fix wrong address access and skip till first valid header
-rw-r--r--src/ufodecode.c7
1 files changed, 5 insertions, 2 deletions
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;