# HG changeset patch # User Matti Hamalainen # Date 1526090582 -10800 # Node ID 237be4e035855c79a0f03907bd57955e6a280a0a # Parent 2acf4578d2e6102cf6d3e924cf44919f028e7be8 Fix Amica Paint decoding off-by-one. diff -r 2acf4578d2e6 -r 237be4e03585 tools/lib64fmts.c --- 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