changeset 1540:237be4e03585

Fix Amica Paint decoding off-by-one.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 12 May 2018 05:03:02 +0300
parents 2acf4578d2e6
children 203e00a4dfc0
files tools/lib64fmts.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Sat May 12 04:55:05 2018 +0300
+++ b/tools/lib64fmts.c	Sat May 12 05:03:02 2018 +0300
@@ -181,14 +181,13 @@
     if ((res = dmGrowBufAlloc(&tmp, len + 4, 4)) != DMERR_OK)
         return res;
 
-    memcpy(tmp.data, buf, len + 1);
+    memcpy(tmp.data, buf, len);
     tmp.len = len + 1;
 
     // Now do an RLE decode on the enlarged buffer
     cfg.type = DM_COMP_RLE_MARKER;
     cfg.rleMarker = 0xC2;
-
-    if ((res = dmDecodeGenericRLE(&mem, tmp.data, tmp.data + tmp.len, &cfg)) != DMERR_OK)
+    if ((res = dmDecodeGenericRLEAlloc(&mem, tmp.data, tmp.data + tmp.len, &cfg)) != DMERR_OK)
         goto out;
 
     // And finally decode to bitmap struct