mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-12 22:25:59 -04:00
- 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:
parent
5766b39845
commit
9bae0b86f9
19 changed files with 870 additions and 814 deletions
|
@ -1049,8 +1049,24 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||
}
|
||||
}
|
||||
|
||||
if ((symbol->scale < 0.01f) || (symbol->scale > 100.0f)) {
|
||||
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "227: Scale out of range (0.01-100)");
|
||||
}
|
||||
if ((symbol->dot_size < 0.01f) || (symbol->dot_size > 20.0f)) {
|
||||
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "221: Invalid dot size");
|
||||
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "221: Dot size out of range (0.01-20)");
|
||||
}
|
||||
|
||||
if ((symbol->height < 0.0f) || (symbol->height > 500.0f)) {
|
||||
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "765: Height out of range (0-500)");
|
||||
}
|
||||
if ((symbol->whitespace_width < 0) || (symbol->whitespace_width > 100)) {
|
||||
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "766: Whitespace width out of range (0-100)");
|
||||
}
|
||||
if ((symbol->whitespace_height < 0) || (symbol->whitespace_height > 100)) {
|
||||
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "767: Whitespace height out of range (0-100)");
|
||||
}
|
||||
if ((symbol->border_width < 0) || (symbol->border_width > 100)) {
|
||||
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "768: Border width out of range (0-100)");
|
||||
}
|
||||
|
||||
if ((symbol->input_mode & 0x07) > 2) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue