diff tools/lib64gfx.c @ 1783:1ce808599129

Add DM_RLE_ZERO_COUNT_MAX flag for RLE decoder which makes it interpret run lengths of 0 as maximum value of the type, e.g. 256 or 65536 (latter is probably useless.)
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 13 Jun 2018 01:34:46 +0300
parents 5ea4713e9e0f
children 523c1d1270d6
line wrap: on
line diff
--- a/tools/lib64gfx.c	Wed Jun 13 01:23:45 2018 +0300
+++ b/tools/lib64gfx.c	Wed Jun 13 01:34:46 2018 +0300
@@ -474,6 +474,9 @@
                         count = tmp2;
                         break;
                 }
+
+                if (count == 0 && (cfg->flags & DM_RLE_ZERO_COUNT_MAX))
+                    count = 256;
             }
             else
             if ((cfg->flags & DM_RLE_WORD_RUNS) && data == cfg->rleMarkerW)
@@ -499,6 +502,9 @@
                         count = (tmp3 << 8) | tmp2;
                         break;
                 }
+
+                if (count == 0 && (cfg->flags & DM_RLE_ZERO_COUNT_MAX))
+                    count = 65536;
             }
         }
         else