From 8d8a528f8ac645cd373b3b1a52ad775c446fd3de Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Mon, 2 Apr 2012 12:26:06 +0200 Subject: Report errors --- src/ufodecode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/ufodecode.c b/src/ufodecode.c index 1874c03..9aa5c91 100644 --- a/src/ufodecode.c +++ b/src/ufodecode.c @@ -402,6 +402,19 @@ static int ufo_decode_frame_channels_v5(ufo_decoder decoder, for (int row = 0; row < num_rows; row++) { for (int pix = 0; pix < 128; pix++) { payload_header_v5 *header = (payload_header_v5 *) &raw[base]; + + if (header->row_number > num_rows) { + fprintf(stderr, "Error: row_number in header is %i instead of %i\n", + header->row_number, row); + abort(); + } + + if (header->pixel_number > 128) { + fprintf(stderr, "Error: pixel_number in header is %i instead of %i\n", + header->pixel_number, pix); + abort(); + } + index = header->row_number * IPECAMERA_WIDTH + header->pixel_number; base += 3; -- cgit v1.2.3