Mercurial > hg > dmlib
changeset 1419:56f643d647b7
Better fix for the RLE decoding bounds issue, not changing
dmDecodeGenericRLE() API.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 05 Nov 2017 23:27:53 +0200 |
parents | d8a509d72449 |
children | 9b7915193683 |
files | tools/lib64gfx.c |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/lib64gfx.c Sun Nov 05 23:27:05 2017 +0200 +++ b/tools/lib64gfx.c Sun Nov 05 23:27:53 2017 +0200 @@ -306,7 +306,7 @@ int res; Uint8 *mem = NULL, *end; - if ((res = dmDecodeGenericRLE(&mem, &end, buf + 0x0e, buf + len, *(buf + 0x0d))) != DMERR_OK) + if ((res = dmDecodeGenericRLE(&mem, &end, buf + 0x0e, buf + len - 1, *(buf + 0x0d))) != DMERR_OK) goto out; res = dmC64DecodeGenericBMP(img, mem, end - mem + 1, fmt); @@ -377,7 +377,7 @@ int res; Uint8 *mem = NULL, *end; - if ((res = dmDecodeGenericRLE(&mem, &end, buf, buf + len, 0xC2)) != DMERR_OK) + if ((res = dmDecodeGenericRLE(&mem, &end, buf, buf + len - 1, 0xC2)) != DMERR_OK) goto out; res = dmC64DecodeGenericBMP(img, mem, end - mem + 1, fmt); @@ -491,7 +491,7 @@ int res; Uint8 *mem = NULL, *end; - if ((res = dmDecodeGenericRLE(&mem, &end, buf + FUNPAINT2_HEADER_SIZE, buf + len, *(buf + 15))) != DMERR_OK) + if ((res = dmDecodeGenericRLE(&mem, &end, buf + FUNPAINT2_HEADER_SIZE, buf + len - 1, *(buf + 15))) != DMERR_OK) goto out; res = dmC64DecodeGenericBMP(img, mem, end - mem + 1, fmt);