diff tools/lib64gfx.c @ 1647:948d6fda722d

Add sanity check for interlaced formats: check that the interlace type flags are set.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 30 May 2018 01:17:57 +0300
parents 262300a0359b
children 9233da9de92c
line wrap: on
line diff
--- a/tools/lib64gfx.c	Wed May 30 01:07:07 2018 +0300
+++ b/tools/lib64gfx.c	Wed May 30 01:17:57 2018 +0300
@@ -48,7 +48,7 @@
     if (img->type & D64_FMT_ILACE)
     {
         char *tmps;
-        switch(img->laceType)
+        switch (img->laceType)
         {
             case D64_ILACE_COLOR: tmps = "color"; break;
             case D64_ILACE_RES: tmps = "resolution"; break;
@@ -773,6 +773,14 @@
         }
     }
 
+    // Sanity check certain things ..
+    if ((fmt->type & D64_FMT_ILACE) && img->laceType == D64_ILACE_NONE)
+    {
+        return dmError(DMERR_INTERNAL,
+            "Format '%s' (%s) has interlace flag set, but interlace type is not set.\n",
+            fmt->name, fmt->fext);
+    }
+
     return DMERR_OK;
 }