libansilove

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

commit 2e29c66e8da6879c8b695ca3dc7beb5c019631a1
parent 435133be3ee9a4e6a64cf0465adc1c8ff92cdf77
Author: Frederic Cambus <fred@statdns.com>
Date:   Wed, 21 Oct 2020 15:36:26 +0200

Add range integrity checks for scale_factor values in the output() function.

Diffstat:
Msrc/output.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/output.c b/src/output.c @@ -37,6 +37,11 @@ output(struct ansilove_ctx *ctx, struct ansilove_options *options, /* Handle resizing */ if (options->scale_factor) { + if (options->scale_factor < 2 || options->scale_factor > 8) { + ctx->error = ANSILOVE_RANGE_ERROR; + return -1; + } + uint32_t width, height; gdImagePtr retina;