summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2012-04-02 12:26:06 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2012-04-02 12:26:06 +0200
commit8d8a528f8ac645cd373b3b1a52ad775c446fd3de (patch)
treee345f4c887634f004887725557041666c7b41400
parentea0ce9cf7575f2a78eb2ab8be9f175e73d4871b2 (diff)
downloadufodecode-8d8a528f8ac645cd373b3b1a52ad775c446fd3de.tar.gz
ufodecode-8d8a528f8ac645cd373b3b1a52ad775c446fd3de.tar.bz2
ufodecode-8d8a528f8ac645cd373b3b1a52ad775c446fd3de.tar.xz
ufodecode-8d8a528f8ac645cd373b3b1a52ad775c446fd3de.zip
Report errors
-rw-r--r--src/ufodecode.c13
1 files changed, 13 insertions, 0 deletions
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;