Mercurial > hg > dmlib
changeset 1797:5204fab92c9e
If the c64 image format has a set size and our buffer after encoding in
dmC64EncodeBMP() is smaller than that size, we grow the buffer to match
(with zeroed data). This accounts for format variants that are otherwise
identical.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 14 Jun 2018 04:00:59 +0300 |
parents | 0801fd0e26cb |
children | 6db41588458c |
files | tools/lib64gfx.c |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/lib64gfx.c Thu Jun 14 03:59:45 2018 +0300 +++ b/tools/lib64gfx.c Thu Jun 14 04:00:59 2018 +0300 @@ -1437,6 +1437,16 @@ if (res != DMERR_OK) goto err; + // Finally, if the format has a set size and our buffer is smaller + // than that size, we grow the buffer to match (with zeroed data). + // This accounts for format variants that are otherwise identical. + if (fmt->size > 0 && buf->len < fmt->size && + !dmGrowBufCheckGrow(buf, fmt->size)) + { + res = DMERR_MALLOC; + goto err; + } + return DMERR_OK; err: