diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2023-09-06 11:44:21 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2023-09-06 11:44:21 +0200 |
commit | 2463d5dfdf1ece466f38b6cd57044dec4caa5b57 (patch) | |
tree | fcf98df1f28eac7d0e6dd0347c85be130d4506d0 /src | |
parent | 005f8d3797a844c892e53d71cd5ae8855dc4bed6 (diff) | |
download | sameboy-thumbnailer-master.tar.gz sameboy-thumbnailer-master.zip |
This fixes a bug with too high scales causing a division by zero
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -58,8 +58,11 @@ static uint32_t average(const uint32_t dest, const uint32_t src) } static void scale_image(const uint32_t* input, const signed input_width, const signed input_height, - uint32_t* output, const double multiplier, const signed samples) + uint32_t* output, const double multiplier, signed samples) { + if (samples <= 0) + samples = 1; + signed output_width = input_width * multiplier; uint32_t pixel; |