changeset 2215:69e868af764c

Check for minimum number of colors in a external palette file.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Jun 2019 06:04:47 +0300
parents f8bba7a82ec2
children 2fa3458b364d
files tools/gfxconv.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/gfxconv.c	Fri Jun 14 06:04:15 2019 +0300
+++ b/tools/gfxconv.c	Fri Jun 14 06:04:47 2019 +0300
@@ -2156,6 +2156,13 @@
     {
         if ((res = dmHandleExternalPalette(optPaletteFile, &optC64Spec.pal)) != DMERR_OK)
             goto exit;
+
+        if (optSpec.pal->ncolors < D64_NCOLORS)
+        {
+            dmErrorMsg("Palette does not have enough colors (%d < %d)\n",
+                optSpec.pal->ncolors, D64_NCOLORS);
+            goto exit;
+        }
     }
     else
     {