- 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

@ -895,26 +895,27 @@ static void test_other_opts(int index, int debug) {
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900", "" },
/* 1*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900AA", "" },
/* 2*/ { BARCODE_CODE128, "1", -1, " --bg=", "GF9900", "Error 654: Malformed background colour target" },
/* 3*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000", "" },
/* 4*/ { BARCODE_CODE128, "1", -1, " --fg=", "00000000", "" },
/* 5*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000F", "Error 651: Malformed foreground colour target" },
/* 6*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000FG", "Error 653: Malformed foreground colour target" },
/* 7*/ { BARCODE_CODE128, "1", -1, " --fontsize=", "10", "" },
/* 8*/ { BARCODE_CODE128, "1", -1, " --fontsize=", "101", "Warning 126: Font size out of range (0 to 100), ignoring" },
/* 9*/ { BARCODE_CODE128, "1", -1, " --nobackground", "", "" },
/* 10*/ { BARCODE_CODE128, "1", -1, " --notext", "", "" },
/* 11*/ { BARCODE_CODE128, "1", -1, " --reverse", "", "" },
/* 12*/ { BARCODE_CODE128, "1", -1, " --werror", NULL, "" },
/* 13*/ { 19, "1", -1, " --werror", NULL, "Error 207: Codabar 18 not supported" },
/* 14*/ { BARCODE_GS1_128, "[01]12345678901231", -1, "", NULL, "" },
/* 15*/ { BARCODE_GS1_128, "0112345678901231", -1, "", NULL, "Error 252: Data does not start with an AI" },
/* 16*/ { BARCODE_GS1_128, "0112345678901231", -1, " --gs1nocheck", NULL, "Error 252: Data does not start with an AI" },
/* 17*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, "", NULL, "" },
/* 18*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, "", NULL, "Warning 261: AI (00) position 18: Bad checksum '8', expected '9'" },
/* 19*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1nocheck", NULL, "" },
/* 20*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --werror", NULL, "Error 261: AI (00) position 18: Bad checksum '8', expected '9'" },
/* 1*/ { BARCODE_CODE128, "1", -1, " -bg=", "EF9900", "" },
/* 2*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900AA", "" },
/* 3*/ { BARCODE_CODE128, "1", -1, " --bg=", "GF9900", "Error 654: Malformed background colour target" },
/* 4*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000", "" },
/* 5*/ { BARCODE_CODE128, "1", -1, " --fg=", "00000000", "" },
/* 6*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000F", "Error 651: Malformed foreground colour target" },
/* 7*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000FG", "Error 653: Malformed foreground colour target" },
/* 8*/ { BARCODE_CODE128, "1", -1, " --fontsize=", "10", "" },
/* 9*/ { BARCODE_CODE128, "1", -1, " --fontsize=", "101", "Warning 126: Font size out of range (0 to 100), ignoring" },
/* 10*/ { BARCODE_CODE128, "1", -1, " --nobackground", "", "" },
/* 11*/ { BARCODE_CODE128, "1", -1, " --notext", "", "" },
/* 12*/ { BARCODE_CODE128, "1", -1, " --reverse", "", "" },
/* 13*/ { BARCODE_CODE128, "1", -1, " --werror", NULL, "" },
/* 14*/ { 19, "1", -1, " --werror", NULL, "Error 207: Codabar 18 not supported" },
/* 15*/ { BARCODE_GS1_128, "[01]12345678901231", -1, "", NULL, "" },
/* 16*/ { BARCODE_GS1_128, "0112345678901231", -1, "", NULL, "Error 252: Data does not start with an AI" },
/* 17*/ { BARCODE_GS1_128, "0112345678901231", -1, " --gs1nocheck", NULL, "Error 252: Data does not start with an AI" },
/* 18*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, "", NULL, "" },
/* 19*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, "", NULL, "Warning 261: AI (00) position 18: Bad checksum '8', expected '9'" },
/* 20*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1nocheck", NULL, "" },
/* 21*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --werror", NULL, "Error 261: AI (00) position 18: Bad checksum '8', expected '9'" },
};
int data_size = ARRAY_SIZE(data);
int i;