libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

commit d60ba27cb6bccd5fa012df07f3e2730383584603
parent 5ec4e7536f6e57ccde20977ae695b983f3964b75
Author: Frederic Cambus <fred@statdns.com>
Date:   Thu, 18 Oct 2018 16:57:29 +0200

Check that ctx and options aren't NULL in the loaders

Diffstat:
Msrc/loaders/ansi.c | 7+++++++
Msrc/loaders/artworx.c | 7+++++++
Msrc/loaders/binary.c | 7+++++++
Msrc/loaders/icedraw.c | 7+++++++
Msrc/loaders/pcboard.c | 7+++++++
Msrc/loaders/tundra.c | 7+++++++
Msrc/loaders/xbin.c | 7+++++++
7 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -29,6 +29,13 @@ struct ansiChar { int ansilove_ansi(struct ansilove_ctx *ctx, struct ansilove_options *options) { + if (ctx == NULL || options == NULL) { + if (ctx) + ctx->error = ANSILOVE_INVALID_PARAM; + + return -1; + } + // ladies and gentlemen, it's type declaration time struct fontStruct fontData; diff --git a/src/loaders/artworx.c b/src/loaders/artworx.c @@ -15,6 +15,13 @@ int ansilove_artworx(struct ansilove_ctx *ctx, struct ansilove_options *options) { + if (ctx == NULL || options == NULL) { + if (ctx) + ctx->error = ANSILOVE_INVALID_PARAM; + + return -1; + } + // libgd image pointers gdImagePtr canvas; diff --git a/src/loaders/binary.c b/src/loaders/binary.c @@ -13,6 +13,13 @@ int ansilove_binary(struct ansilove_ctx *ctx, struct ansilove_options *options) { + if (ctx == NULL || options == NULL) { + if (ctx) + ctx->error = ANSILOVE_INVALID_PARAM; + + return -1; + } + // some type declarations struct fontStruct fontData; diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -15,6 +15,13 @@ int ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) { + if (ctx == NULL || options == NULL) { + if (ctx) + ctx->error = ANSILOVE_INVALID_PARAM; + + return -1; + } + // extract relevant part of the IDF header, 16-bit endian unsigned short uint32_t x2 = (ctx->buffer[9] << 8) + ctx->buffer[8]; diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c @@ -22,6 +22,13 @@ struct pcbChar { int ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options) { + if (ctx == NULL || options == NULL) { + if (ctx) + ctx->error = ANSILOVE_INVALID_PARAM; + + return -1; + } + // some type declarations struct fontStruct fontData; uint32_t loop, structIndex; diff --git a/src/loaders/tundra.c b/src/loaders/tundra.c @@ -20,6 +20,13 @@ int ansilove_tundra(struct ansilove_ctx *ctx, struct ansilove_options *options) { + if (ctx == NULL || options == NULL) { + if (ctx) + ctx->error = ANSILOVE_INVALID_PARAM; + + return -1; + } + // some type declarations struct fontStruct fontData; char tundra_version; diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c @@ -13,6 +13,13 @@ int ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options) { + if (ctx == NULL || options == NULL) { + if (ctx) + ctx->error = ANSILOVE_INVALID_PARAM; + + return -1; + } + const unsigned char *font_data; unsigned char *font_data_xbin = NULL;