ansilove

ANSI and ASCII art to PNG converter in C
Log | Files | Refs | README | LICENSE

commit e668ca29a50b70ceea46dfc022bd40bb617af7b9
parent 4ebb44db8b2c798dddaff0b3b38740c31998d10b
Author: Frederic Cambus <fred@statdns.com>
Date:   Sat, 13 May 2017 18:49:39 +0200

Ensure binary files have an even size

Diffstat:
Msrc/loaders/binary.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/loaders/binary.c b/src/loaders/binary.c @@ -13,6 +13,12 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFile, char *retinaout, int32_t columns, char *font, int32_t bits, bool icecolors, bool createRetinaRep) { + // binary files must have an even size + if (inputFileSize % 2) { + fprintf(stderr, "\nBinary file is not valid.\n"); + exit(1); + } + // some type declarations struct fontStruct fontData;