1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-01-22 11:26:03 +00:00

ZBarcode_Encode_Segs: fuller debug output (all input fields)

test suite: fuzz: update for new symbologies & suppress some
  clang-tidy warnings
common: better `z_iscntrl()`
BWIPP: update to latest
This commit is contained in:
gitlost
2026-01-11 20:51:18 +00:00
parent 64aa8e654c
commit a718c79237
9 changed files with 78 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
/* fuzz.h - common functions for fuzzing libzint */
/*
libzint - the open source barcode library
Copyright (C) 2024-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2024-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -175,12 +175,12 @@ static const struct settings_item settings[] = {
{ 7, BARCODE_C25IND, NEON_F, 0, -1, 0, 2, 0, 1, 79 },
{ 8, BARCODE_CODE39, SILVER_F, 0, -1, 0, 2, 0, 1, 86 },
{ 9, BARCODE_EXCODE39, SILVER_F, 0, -1, 0, 2, 0, 1, 86 },
{ 10, /*symbology*/ -1, /*sane_flag*/ 0, /*opt_1*/ 0, -1, /*opt_2*/ 0, -1, /*opt_3*/ 0, /*len*/ 0, -1 },
{ 11, /*symbology*/ -1, /*sane_flag*/ 0, /*opt_1*/ 0, -1, /*opt_2*/ 0, -1, /*opt_3*/ 0, /*len*/ 0, -1 },
{ 12, /*symbology*/ -1, /*sane_flag*/ 0, /*opt_1*/ 0, -1, /*opt_2*/ 0, -1, /*opt_3*/ 0, /*len*/ 0, -1 },
{ 10, BARCODE_EAN8, SODIUM_PLS_F, 0, -1, 0, -1, 0, 1, 14 },
{ 11, BARCODE_EAN_2ADDON, NEON_F, 0, -1, 0, -1, 0, 1, 2 },
{ 12, BARCODE_EAN_5ADDON, NEON_F, 0, -1, 0, -1, 0, 1, 5 },
{ 13, BARCODE_EANX, SODIUM_PLS_F, 0, -1, 0, -1, 0, 1, 19 },
{ 14, BARCODE_EANX_CHK, SODIUM_PLS_F, 0, -1, 0, -1, 0, 1, 19 },
{ 15, /*symbology*/ -1, /*sane_flag*/ 0, /*opt_1*/ 0, -1, /*opt_2*/ 0, -1, /*opt_3*/ 0, /*len*/ 0, -1 },
{ 15, BARCODE_EAN13, SODIUM_PLS_F, 0, -1, 0, -1, 0, 1, 19 },
{ 16, BARCODE_GS1_128, ASCII_PRT_F, 0, -1, 0, -1, 0, 3, 198 },
{ 17, /*symbology*/ -1, /*sane_flag*/ 0, /*opt_1*/ 0, -1, /*opt_2*/ 0, -1, /*opt_3*/ 0, /*len*/ 0, -1 },
{ 18, BARCODE_CODABAR, CALCIUM_F, 0, -1, 0, 2, 0, 3, 103 },
@@ -313,6 +313,8 @@ static const struct settings_item settings[] = {
{ 145, BARCODE_RMQR, 0, -1, 4, 0, 38, 0, 1, 361 },
{ 146, BARCODE_BC412, ARSENIC_F, 0, -1, 0, -1, 0, 7, 18 },
{ 147, BARCODE_DXFILMEDGE, SILVER_F, 0, -1, 0, -1, 0, 1, 10 },
{ 148, BARCODE_EAN8_CC, SODIUM_PLS_F, 0, 2, 0, -1, 0, 1, 335 },
{ 149, BARCODE_EAN13_CC, SODIUM_PLS_F, 0, 2, 0, -1, 0, 1, 338 },
};
/* Make sure value `v` is between `min` and `max` */

View File

@@ -1,7 +1,7 @@
/* fuzz_gs1.c - fuzzer for libzint (GS1-enabled symbologies, GS1_MODE) */
/*
libzint - the open source barcode library
Copyright (C) 2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2024-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -84,11 +84,11 @@ int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
if (is_composite) {
if (idx == BARCODE_GS1_128_CC || idx == BARCODE_DBAR_EXP_CC || idx == BARCODE_DBAR_EXPSTK_CC) {
strcpy(symbol->primary, primary_ai);
memcpy(symbol->primary, primary_ai, sizeof(primary_ai));
} else if (idx == BARCODE_UPCE_CC) {
strcpy(symbol->primary, primary_upce);
memcpy(symbol->primary, primary_upce, sizeof(primary_upce));
} else {
strcpy(symbol->primary, primary);
memcpy(symbol->primary, primary, sizeof(primary));
}
}

View File

@@ -1,5 +1,6 @@
/* gen_corpora.c - write out initial fuzz data for zint, allowing for how `set_symbol()` in "fuzz.h" uses first X
bytes to set various `zint_symbol` members (namely `input_mode`, `option_1`, `option_2`, `eci`, `option_3`) */
/* NOLINTBEGIN(clang-diagnostic-comment) */
/*
From "backend/tests/fuzz" directory:
@@ -10,6 +11,7 @@
zip -j fuzz_data_seed_corpus.zip fuzz_data_corpus/*
zip -j fuzz_gs1_seed_corpus.zip fuzz_gs1_corpus/*
*/
/* NOLINTEND(clang-diagnostic-comment) */
/*
libzint - the open source barcode library
Copyright (C) 2024-2025 Robin Stuart <rstuart114@gmail.com>
@@ -52,6 +54,7 @@ extern "C" {
#include "fuzz.h"
/* Data item */
/* NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding) disable "Excessive padding" warning */
struct item {
int test_fuzz_idx;
int symbology;