1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-05-12 00:53:49 +00:00

raster/vector: fix BARCODE_BIND_TOP trumping BARCODE_BOX

backend/tests/fuzz: update "fuzz.h" to take `option_3` min/max;
  update `INPUT_MODE_MASK` & `OUTPUT_OPTIONS_MASK`;
  set `height`, `border_width` & `output_options` from input
  (removing `Z_FUZZ_SET_OUTPUT_OPTIONS` conditional) and call
  `ZBarcode_Encode_and_Print()` instead of `ZBarcode_Encode()`;
  support standalone builds of "fuzz_data" & "fuzz_gs1" with
  `Z_FUZZ_MAIN_READ_ARGV_1` macro;
  update "fuzz_gs1" & "fuzz_gs1.dict" to better test caret/raw
  modes;
  gen_corpora: add `output_options`, `height` & `border_width` &
  find (3rd) from fuzz_data of BIND_TOP | BIND_BOX bug
This commit is contained in:
gitlost
2026-03-22 15:05:53 +00:00
parent f6174cba04
commit 56fca5b2a1
18 changed files with 494 additions and 307 deletions

View File

@@ -1017,24 +1017,24 @@ INTERNAL int zint_plot_vector(struct zint_symbol *symbol, int rotate_angle, int
last_rect->x = xoffset;
last_rect->width -= xoffset + roffset;
}
}
if (symbol->output_options & BARCODE_BOX) {
const float xbox_right = vector->width - symbol->border_width;
float box_top = yoffset;
/* Following equivalent to symbol->height except for BARCODE_MAXICODE */
float box_height = vector->height - textoffset - dot_overspill - yoffset - boffset;
if (horz_outside) {
box_top = symbol->border_width;
box_height = vector->height - symbol->border_width * 2;
} else if (upceanflag == 2 || upceanflag == 5) {
box_top += textoffset;
if (symbol->output_options & BARCODE_BOX) {
const float xbox_right = vector->width - symbol->border_width;
float box_top = yoffset;
/* Following equivalent to symbol->height except for BARCODE_MAXICODE */
float box_height = vector->height - textoffset - dot_overspill - yoffset - boffset;
if (horz_outside) {
box_top = symbol->border_width;
box_height = vector->height - symbol->border_width * 2;
} else if (upceanflag == 2 || upceanflag == 5) {
box_top += textoffset;
}
/* Left */
if (!vector_add_rect(symbol, 0.0f, box_top, symbol->border_width, box_height, &last_rect))
return ZINT_ERROR_MEMORY;
/* Right */
if (!vector_add_rect(symbol, xbox_right, box_top, symbol->border_width, box_height, &last_rect))
return ZINT_ERROR_MEMORY;
}
/* Left */
if (!vector_add_rect(symbol, 0.0f, box_top, symbol->border_width, box_height, &last_rect))
return ZINT_ERROR_MEMORY;
/* Right */
if (!vector_add_rect(symbol, xbox_right, box_top, symbol->border_width, box_height, &last_rect))
return ZINT_ERROR_MEMORY;
}
}