Mercurial > hg > dmlib
diff tools/lib64gfx.c @ 2196:28871f500e84
Add new "flags" field to DMC64EncDecOp, defined by DF_* that can be used to
specify additional control over the operator blocks.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 13 Jun 2019 22:07:16 +0300 |
parents | 71880ce885dd |
children | dcd26cdc395e |
line wrap: on
line diff
--- a/tools/lib64gfx.c Thu Jun 13 22:02:04 2019 +0300 +++ b/tools/lib64gfx.c Thu Jun 13 22:07:16 2019 +0300 @@ -836,6 +836,13 @@ int dmC64SanityCheckEncDecOp(const int i, const DMC64EncDecOp *op, const DMC64Image *img) { + if (op->flags == 0) + { + return dmError(DMERR_INTERNAL, + "Invalid operation flags value %d in generic encode/decode operator %d @ #%d.\n", + op->flags, op->type, i); + } + switch (op->type) { case DO_COPY: @@ -1015,6 +1022,10 @@ if ((res = dmC64SanityCheckEncDecOp(i, op, img)) != DMERR_OK) return res; + // Check flags + if ((op->flags & DF_DECODE) == 0) + continue; + // Is the operation inside the bounds? size = dmC64GetOpSubjectSize(op, fmt->format); if (op->type == DO_COPY && op->offs + size > buf->len + 1) @@ -1220,6 +1231,10 @@ if ((res = dmC64SanityCheckEncDecOp(i, op, img)) != DMERR_OK) goto err; + // Check flags + if ((op->flags & DF_ENCODE) == 0) + continue; + // Do we need to reallocate some more space? size = dmC64GetOpSubjectSize(op, fmt->format); chksize = buf->offs + op->offs + size;