Mercurial > hg > dmlib
diff tools/lib64fmts.c @ 1791:ae53df2156ed
Add buffer expansion quirk to Boogie Down Paint decoder, as it seems to be needed.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 13 Jun 2018 03:22:49 +0300 |
parents | 9f5c5ab0e85e |
children | 905c09049fe6 |
line wrap: on
line diff
--- a/tools/lib64fmts.c Wed Jun 13 03:01:53 2018 +0300 +++ b/tools/lib64fmts.c Wed Jun 13 03:22:49 2018 +0300 @@ -200,8 +200,15 @@ cfg.rleMarkerB = buf->data[8]; cfg.rleMarkerW = buf->data[9]; - if ((res = dmDecodeGenericRLEAlloc(&mem, - dmGrowBufConstCopyOffs(&tmp, buf, 10), &cfg)) != DMERR_OK) + // Boogie Down Paint apparently is broken and stores one byte less + // than it should in some cases so we need to do some crappy buffer + // expansion here .. + if (dmGrowBufCopyOffs(&tmp, buf, 10, 1) == NULL) + return DMERR_MALLOC; + + tmp.len = tmp.size; + + if ((res = dmDecodeGenericRLEAlloc(&mem, &tmp, &cfg)) != DMERR_OK) goto out; res = dmC64DecodeGenericBMP(img, &mem, fmt);