- raster.c: Need ceilf(symbol->height * si) to avoid heap-buffer-overflow;

also avoid distributive multiplication with floats to lessen chances of
  platform variation (#204 ARM-Cortex crash)
- raster.c: Don't allow for text if scale < 1.0
- raster.c: Cast some indexes to (size_t) to allow for large scale
- vector.c: Check malloc()s and return ZINT_ERROR_MEMORY on fail
- raster/vector.c: various var name changes & other code fiddling
- library.c: Check that scale/height/whitespace/border are reasonable values:
  scale (0.01-100), height (0-500), whitespace_width/height (0-100),
  border_width (0-100)
- CLI: allow both e.g. '-height' and '--height' (getopt_long_only())
- gif.c: fix GIF_ZLW_PAGE_SIZE -> GIF_LZW_PAGE_SIZE
- GUI: allow whitespace/scale to 100
This commit is contained in:
gitlost
2021-09-20 14:56:27 +01:00
parent 5766b39845
commit 9bae0b86f9
19 changed files with 870 additions and 814 deletions

View File

@ -1,7 +1,7 @@
/* output.h - Common routines for raster/vector
libzint - the open source barcode library
Copyright (C) 2020 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020 - 2021 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -38,9 +38,10 @@ extern "C" {
#endif /* __cplusplus */
INTERNAL int output_check_colour_options(struct zint_symbol *symbol);
INTERNAL void output_set_whitespace_offsets(struct zint_symbol *symbol, float *xoffset, float *yoffset,
float *roffset, float *boffset);
INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width, int *p_comp_offset,
INTERNAL void output_set_whitespace_offsets(const struct zint_symbol *symbol,
float *xoffset, float *yoffset, float *roffset, float *boffset, const float scaler,
int *xoffset_si, int *yoffset_si, int *roffset_si, int *boffset_si);
INTERNAL int output_process_upcean(const struct zint_symbol *symbol, int *p_main_width, int *p_comp_xoffset,
unsigned char addon[6], int *p_addon_gap);
INTERNAL float output_large_bar_height(struct zint_symbol *symbol, int si);
INTERNAL void output_upcean_split_text(int upceanflag, unsigned char text[],