From a14fe77aa05ce94360585118cf625934788ba079 Mon Sep 17 00:00:00 2001 From: gitlost Date: Mon, 27 Nov 2023 12:55:53 +0000 Subject: [PATCH] EANX_CC/UPCA_CC: fix crash in `dbar_date()` on not checking length in `cc_binary_string()`, ticket #300 (#5 & #6), props Andre Maute; add other checks for length on processing encoding mode PDF417: fix out-of-bounds crash on overrunning string and codeword buffers by tripling size (convert to `short` instead of `int` to guard against too much stack), ticket #300 (#7 & #10), props Andre Maute; (TODO: add some checks instead to bail out earlier?) CODEONE: fix looping on latch crash in `c1_encode()`, ticket #300 (#8), props Andre Maute CODABLOCKF: fix crash on negative overflow of `columns` (`option_2`), ticket #300 (#9), props Andre Maute library: add `debug_print_escape()` helper for ZINT_DEBUG_PRINT --- ChangeLog | 10 +- backend/codablock.c | 3 + backend/code1.c | 13 +- backend/code1.h | 9 +- backend/common.c | 18 + backend/common.h | 2 + backend/composite.c | 96 +++-- backend/library.c | 28 +- backend/pdf417.c | 39 +- backend/pdf417.h | 2 +- backend/rss.c | 19 +- backend/tests/test_codablock.c | 56 ++- backend/tests/test_code1.c | 22 +- backend/tests/test_composite.c | 17 +- backend/tests/test_pdf417.c | 416 ++++++++++++++++++---- backend/tests/tools/run_bwipp_tests.sh | 2 + backend/tests/tools/run_zxingcpp_tests.sh | 2 + 17 files changed, 561 insertions(+), 193 deletions(-) diff --git a/ChangeLog b/ChangeLog index 474a811d..282910e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -119,8 +119,14 @@ Bugs byte-blocks > 11-bit limit - library: fix 21-bit Unicode conversion in `escape_char_process()`; fix restricting escaped data length by using de-escaped length to check -- CODEONE: fix out-of-bounds crash in `c1_c40text_cnt()`, ticket #300, props - Andre Maute +- CODEONE: fix out-of-bounds crash in `c1_c40text_cnt()` and looping on latch + crash in `c1_encode()`, ticket #300, props Andre Maute +- CODABLOCKF: fix crash due to `columns` overflow, ticket #300, props Andre + Maute +- EANX_CC/UPCA_CC: fix crash in `dbar_date()` on not checking length, ticket + #300, props Andre Maute +- PDF417: fix out-of-bounds crash on overrunning string and codeword buffers, + ticket #300, props Andre Maute Version 2.12.0 (2022-12-12) diff --git a/backend/codablock.c b/backend/codablock.c index f71c8b6c..b1004983 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -586,6 +586,9 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int strcpy(symbol->errtxt, "411: Columns parameter not in 0, 9..67"); return ZINT_ERROR_INVALID_OPTION; } + if (columns < 0) { /* Protect against negative overflow (ticket #300 (#9) Andre Maute) */ + columns = 0; + } data = (unsigned char *) z_alloca(length * 2 + 1); diff --git a/backend/code1.c b/backend/code1.c index 128974a5..27f3d4dd 100644 --- a/backend/code1.c +++ b/backend/code1.c @@ -37,6 +37,13 @@ #include "reedsol.h" #include "large.h" +#define C1_ASCII 1 +#define C1_C40 2 +#define C1_DECIMAL 3 +#define C1_TEXT 4 +#define C1_EDI 5 +#define C1_BYTE 6 + /* Add solid bar */ static void c1_horiz(struct zint_symbol *symbol, const int row_no, const int full) { int i; @@ -477,7 +484,7 @@ static void c1_eci_escape(const int eci, unsigned char source[], const int lengt /* Convert to codewords */ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int length, const int eci, const int seg_count, const int gs1, unsigned int target[], int *p_tp, int *p_last_mode) { - int current_mode, next_mode; + int current_mode, next_mode, last_mode; int sp = 0; int tp = *p_tp; int i; @@ -563,6 +570,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len } do { + last_mode = current_mode; if (current_mode != next_mode) { /* Change mode */ switch (next_mode) { @@ -625,6 +633,9 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len /* Step B6 */ next_mode = c1_look_ahead_test(source, length, sp, current_mode, gs1); + if (next_mode == last_mode) { /* Avoid looping on latch (ticket #300 (#8) Andre Maute) */ + next_mode = C1_ASCII; + } if (next_mode == C1_ASCII) { if (debug_print) printf("ASC(%d) ", source[sp]); diff --git a/backend/code1.h b/backend/code1.h index 5f9ad231..70c50635 100644 --- a/backend/code1.h +++ b/backend/code1.h @@ -1,7 +1,7 @@ /* code1.h - Lookup info for USS Code One */ /* libzint - the open source barcode library - Copyright (C) 2009-2022 Robin Stuart + Copyright (C) 2009-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -97,12 +97,5 @@ static const unsigned short c1_grid_height[] = { 5, 7, 10, 15, 21, 30, 46, 68 }; -#define C1_ASCII 1 -#define C1_C40 2 -#define C1_DECIMAL 3 -#define C1_TEXT 4 -#define C1_EDI 5 -#define C1_BYTE 6 - /* vim: set ts=4 sw=4 et : */ #endif /* Z_CODE1_H */ diff --git a/backend/common.c b/backend/common.c index 9a8fee60..ee8dbcde 100644 --- a/backend/common.c +++ b/backend/common.c @@ -607,6 +607,24 @@ INTERNAL void debug_test_codeword_dump(struct zint_symbol *symbol, const unsigne symbol->errtxt[strlen(symbol->errtxt) - 1] = '\0'; /* Zap last space */ } +/* Dumps decimal-formatted codewords in symbol->errtxt (for use in testing) */ +INTERNAL void debug_test_codeword_dump_short(struct zint_symbol *symbol, const short *codewords, const int length) { + int i, max = 0, cnt_len, errtxt_len; + char temp[20]; + errtxt_len = sprintf(symbol->errtxt, "(%d) ", length); /* Place the number of codewords at the front */ + for (i = 0, cnt_len = errtxt_len; i < length; i++) { + cnt_len += sprintf(temp, "%d ", codewords[i]); + if (cnt_len > 92) { + break; + } + max++; + } + for (i = 0; i < max; i++) { + errtxt_len += sprintf(symbol->errtxt + errtxt_len, "%d ", codewords[i]); + } + symbol->errtxt[strlen(symbol->errtxt) - 1] = '\0'; /* Zap last space */ +} + /* Dumps decimal-formatted codewords in symbol->errtxt (for use in testing) */ INTERNAL void debug_test_codeword_dump_int(struct zint_symbol *symbol, const int *codewords, const int length) { int i, max = 0, cnt_len, errtxt_len; diff --git a/backend/common.h b/backend/common.h index 12043c4f..e37bf1c5 100644 --- a/backend/common.h +++ b/backend/common.h @@ -276,6 +276,8 @@ INTERNAL void segs_cpy(const struct zint_symbol *symbol, const struct zint_seg s /* Dumps hex-formatted codewords in symbol->errtxt (for use in testing) */ INTERNAL void debug_test_codeword_dump(struct zint_symbol *symbol, const unsigned char *codewords, const int length); /* Dumps decimal-formatted codewords in symbol->errtxt (for use in testing) */ +INTERNAL void debug_test_codeword_dump_short(struct zint_symbol *symbol, const short *codewords, const int length); +/* Dumps decimal-formatted codewords in symbol->errtxt (for use in testing) */ INTERNAL void debug_test_codeword_dump_int(struct zint_symbol *symbol, const int *codewords, const int length); #endif diff --git a/backend/composite.c b/backend/composite.c index 2646ac59..7d39b0f3 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -71,7 +71,7 @@ INTERNAL int dbar_omnstk_set_height(struct zint_symbol *symbol, const int first_ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows); INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows); INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows); -INTERNAL int dbar_date(const unsigned char source[], const int src_posn); +INTERNAL int dbar_date(const unsigned char source[], const int length, const int src_posn); static int _min(const int first, const int second) { @@ -301,7 +301,8 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w const int length = (int) strlen(source) / 8; int i; unsigned char *data_string = (unsigned char *) z_alloca(length + 3); - int chainemc[180], mclength = 0; + short chainemc[180]; + int mclength = 0; int k, j, p, longueur, mccorrection[50] = {0}, offset; int total; char pattern[580]; @@ -517,7 +518,8 @@ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_w const int length = (int) strlen(source) / 8; int i, p; unsigned char *data_string = (unsigned char *) z_alloca(length + 4); - int chainemc[1000], mclength = 0, k; + short chainemc[1000]; + int mclength = 0, k; int offset, longueur, loop, total, j, mccorrection[520] = {0}; int c1, c2, c3, dummy[35]; char pattern[580]; @@ -843,14 +845,14 @@ static int calc_padding_ccc(const int binary_length, int *cc_width, const int li } /* Handles all data encodation from section 5 of ISO/IEC 24723 */ -static int cc_binary_string(struct zint_symbol *symbol, const unsigned char source[], const int source_len, +static int cc_binary_string(struct zint_symbol *symbol, const unsigned char source[], const int length, char binary_string[], const int cc_mode, int *cc_width, int *ecc, const int linear_width) { int encoding_method, read_posn, alpha_pad; int i, j, ai_crop, ai_crop_posn, fnc1_latch; int ai90_mode, remainder; char last_digit = '\0'; int mode; - char *general_field = (char *) z_alloca(source_len + 1); + char *general_field = (char *) z_alloca(length + 1); int target_bitsize; int bp = 0; const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; @@ -865,12 +867,12 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour target_bitsize = 0; mode = NUMERIC; - if ((source[0] == '1') && ((source[1] == '0') || (source[1] == '1') || (source[1] == '7'))) { + if (length > 1 && (source[0] == '1') && ((source[1] == '0') || (source[1] == '1') || (source[1] == '7'))) { /* Source starts (10), (11) or (17) */ - if (source[1] == '0' || dbar_date(source, 2) >= 0) { /* Check date valid if (11) or (17) */ + if (source[1] == '0' || dbar_date(source, length, 2) >= 0) { /* Check date valid if (11) or (17) */ encoding_method = 2; } - } else if ((source[0] == '9') && (source[1] == '0')) { + } else if (length > 1 && (source[0] == '9') && (source[1] == '0')) { /* Source starts (90) */ encoding_method = 3; } @@ -890,8 +892,9 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour read_posn = 2; } else { /* Production Date (11) or Expiration Date (17) */ + assert(length >= 8); /* Due to `dbar_date()` check above */ - bp = bin_append_posn(dbar_date(source, 2), 16, binary_string, bp); + bp = bin_append_posn(dbar_date(source, length, 2), 16, binary_string, bp); if (source[1] == '1') { /* Production Date AI 11 */ @@ -902,7 +905,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour } read_posn = 8; - if ((source[read_posn] == '1') && (source[read_posn + 1] == '0')) { + if (read_posn + 1 < length && (source[read_posn] == '1') && (source[read_posn + 1] == '0')) { /* Followed by AI 10 - strip this from general field */ read_posn += 2; } else if (source[read_posn]) { @@ -925,20 +928,21 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour } else if (encoding_method == 3) { /* Encodation Method field of "11" - AI 90 */ - char *ninety = (char *) z_alloca(source_len + 1); - int ninety_len, alpha, alphanum, numeric, test1, test2, test3; + unsigned char *ninety = (unsigned char *) z_alloca(length + 1); + int ninety_len, alpha, alphanum, numeric, alpha_posn; /* "This encodation method may be used if an element string with an AI 90 occurs at the start of the data message, and if the data field following the two-digit AI 90 starts with an alphanumeric string which complies with a specific format." (para 5.3.2) */ - memset(ninety, 0, source_len + 1); i = 0; - do { - ninety[i] = source[i + 2]; - i++; - } while ((source_len > i + 2) && ('[' != source[i + 2])); + if (length > 2) { + do { + ninety[i] = source[i + 2]; + i++; + } while ((length > i + 2) && ('[' != source[i + 2])); + } ninety[i] = '\0'; ninety_len = i; @@ -962,36 +966,27 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour } /* must start with 0, 1, 2 or 3 digits followed by an uppercase character */ - test1 = -1; - for (i = 3; i >= 0; i--) { - if (z_isupper(ninety[i])) { - test1 = i; + alpha_posn = -1; + if (ninety_len && ninety[0] != '0') { /* Leading zeros are not permitted */ + for (i = 0; i < ninety_len && i < 4; i++) { + if (z_isupper(ninety[i])) { + alpha_posn = i; + break; + } + if (!z_isdigit(ninety[i])) { + break; + } } } - test2 = 0; - for (i = 0; i < test1; i++) { - if (!z_isdigit(ninety[i])) { - test2 = 1; - break; - } - } - - /* leading zeros are not permitted */ - test3 = 0; - if ((test1 >= 1) && (ninety[0] == '0')) { - test3 = 1; - } - - if ((test1 != -1) && (test2 != 1) && (test3 == 0)) { + if (alpha_posn != -1) { int next_ai_posn; - char numeric_part[4]; int numeric_value; int table3_letter; /* Encodation method "11" can be used */ bp = bin_append_posn(3, 2, binary_string, bp); /* "11" */ - numeric -= test1; + numeric -= alpha_posn; alpha--; /* Decide on numeric, alpha or alphanumeric mode */ @@ -1016,13 +1011,13 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour next_ai_posn = 2 + ninety_len; - if (next_ai_posn < source_len && source[next_ai_posn] == '[') { + if (next_ai_posn < length && source[next_ai_posn] == '[') { /* There are more AIs afterwards */ - if (next_ai_posn + 2 < source_len + if (next_ai_posn + 2 < length && (source[next_ai_posn + 1] == '2') && (source[next_ai_posn + 2] == '1')) { /* AI 21 follows */ ai_crop = 1; - } else if (next_ai_posn + 4 < source_len + } else if (next_ai_posn + 4 < length && (source[next_ai_posn + 1] == '8') && (source[next_ai_posn + 2] == '0') && (source[next_ai_posn + 3] == '0') && (source[next_ai_posn + 4] == '4')) { /* AI 8004 follows */ @@ -1041,20 +1036,11 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour break; } - if (test1 == 0) { - strcpy(numeric_part, "0"); - } else { - for (i = 0; i < test1; i++) { - numeric_part[i] = ninety[i]; - } - numeric_part[i] = '\0'; - } - - numeric_value = atoi(numeric_part); + numeric_value = alpha_posn ? to_int(ninety, alpha_posn) : 0; table3_letter = -1; if (numeric_value < 31) { - table3_letter = posn("BDHIJKLNPQRSTVWZ", ninety[test1]); + table3_letter = posn("BDHIJKLNPQRSTVWZ", ninety[alpha_posn]); } if (table3_letter != -1) { @@ -1071,10 +1057,10 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour bp = bin_append_posn(numeric_value, 10, binary_string, bp); /* five bit representation of ASCII character */ - bp = bin_append_posn(ninety[test1] - 65, 5, binary_string, bp); + bp = bin_append_posn(ninety[alpha_posn] - 65, 5, binary_string, bp); } - read_posn = test1 + 3; + read_posn = alpha_posn + 3; /* +2 for 90 and +1 to go beyond alpha position */ /* Do Alpha mode encoding of the rest of the AI 90 data field here */ if (ai90_mode == 2) { @@ -1118,7 +1104,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour j++; } - for (i = read_posn; i < source_len; i++) { + for (i = read_posn; i < length; i++) { /* Skip "[21" or "[8004" AIs if encodation method "11" used */ if (i == ai_crop_posn) { i += ai_crop; diff --git a/backend/library.c b/backend/library.c index 15eef0b7..a7ff0d02 100644 --- a/backend/library.c +++ b/backend/library.c @@ -677,6 +677,20 @@ static int reduced_charset(struct zint_symbol *symbol, struct zint_seg segs[], c return error_number; } +/* Helper for ZINT_DEBUG_PRINT to put all but graphical ASCII in angle brackets */ +static void debug_print_escape(const unsigned char *source, const int first_len, char *buf) { + int i, j = 0; + for (i = 0; i < first_len; i++) { + const unsigned char ch = source[i]; + if (ch < 32 || ch >= 127) { + j += sprintf(buf + j, "<%03o>", ch & 0xFF); + } else { + buf[j++] = ch; + } + } + buf[j] = '\0'; +} + #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif @@ -1005,14 +1019,18 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ const int len = local_segs[0].length; const int primary_len = symbol->primary[0] ? (int) strlen(symbol->primary) : 0; char name[32]; + char source[151], primary[151]; /* 30*5 + 1 = 151 */ (void) ZBarcode_BarcodeName(symbol->symbology, name); - printf("\nZBarcode_Encode_Segs: %s (%d), input_mode: 0x%X, ECI: %d, option_1: %d, option_2: %d" - ", option_3: %d,\n scale: %g, output_options: 0x%X, fg: %s, bg: %s" - ", seg_count: %d,\n %ssource%s (%d): \"%.*s\", %sprimary (%d): \"%.20s\"\n", + debug_print_escape(local_segs[0].source, len > 30 ? 30 : len, source); + debug_print_escape((const unsigned char *) symbol->primary, primary_len > 30 ? 30 : primary_len, primary); + printf("\nZBarcode_Encode_Segs: %s (%d), input_mode: 0x%X, ECI: %d, option_1/2/3: (%d, %d, %d)\n" + " scale: %g, output_options: 0x%X, fg: %s, bg: %s, seg_count: %d,\n" + " %ssource%s (%d): \"%s\",\n" + " %sprimary (%d): \"%s\"\n", name, symbol->symbology, symbol->input_mode, symbol->eci, symbol->option_1, symbol->option_2, symbol->option_3, symbol->scale, symbol->output_options, symbol->fgcolour, symbol->bgcolour, - seg_count, len > 20 ? "First 20 " : "", seg_count > 1 ? "[0]" : "", len, len > 20 ? 20 : len, - local_segs[0].source, primary_len > 20 ? "First 20 " : "", primary_len, symbol->primary); + seg_count, len > 30 ? "first 30 " : "", seg_count > 1 ? "[0]" : "", len, source, + primary_len > 30 ? "first 30 " : "", primary_len, primary); } if (total_len > ZINT_MAX_DATA_LEN) { diff --git a/backend/pdf417.c b/backend/pdf417.c index 76716459..ce8f4f9a 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -146,6 +146,7 @@ static const char pdf_MicroAutosize[56] = { /* ISO/IEC 15438:2015 5.1.1 c) 3) Max possible number of characters at error correction level 0 (Numeric Compaction mode) */ #define PDF_MAX_LEN 2710 +#define PDF_MAX_STREAM_LEN (PDF_MAX_LEN * 3) /* Allow for tripling up due to shifts/latches (ticket #300 (#7)) */ /* ISO/IEC 24728:2006 5.1.1 c) 3) Max possible number of characters (Numeric Compaction mode) */ #define MICRO_PDF_MAX_LEN 366 @@ -165,7 +166,7 @@ static int pdf_quelmode(const unsigned char codeascii) { } /* Helper to switch TEX mode sub-mode */ -static int pdf_textprocess_switch(const int curtable, const int newtable, int chainet[PDF_MAX_LEN], int wnet) { +static int pdf_textprocess_switch(const int curtable, const int newtable, unsigned char chainet[PDF_MAX_STREAM_LEN], int wnet) { switch (curtable) { case T_ALPHA: switch (newtable) { @@ -234,7 +235,8 @@ static int pdf_text_num_length(int liste[3][PDF_MAX_LEN], const int indexliste, /* Calculate length of TEX allowing for sub-mode switches (no-output version of `pdf_textprocess()`) */ static int pdf_text_submode_length(const unsigned char chaine[], const int start, const int length, int *p_curtable) { - int j, indexlistet, curtable = *p_curtable, listet[PDF_MAX_LEN], chainet[PDF_MAX_LEN], wnet = 0; + int j, indexlistet, curtable = *p_curtable, listet[PDF_MAX_LEN], wnet = 0; + unsigned char chainet[PDF_MAX_STREAM_LEN]; for (indexlistet = 0; indexlistet < length; indexlistet++) { assert(pdf_asciix[chaine[start + indexlistet]]); /* Should only be dealing with TEX */ @@ -397,8 +399,8 @@ static void pdf_appendix_d_encode(const unsigned char *chaine, int liste[3][PDF_ } /* Helper to pad TEX mode, allowing for whether last segment or not, writing out `chainet` */ -static void pdf_textprocess_end(int *chainemc, int *p_mclength, const int is_last_seg, int chainet[PDF_MAX_LEN], - int wnet, int *p_curtable, int *p_tex_padded) { +static void pdf_textprocess_end(short *chainemc, int *p_mclength, const int is_last_seg, + unsigned char chainet[PDF_MAX_STREAM_LEN], int wnet, int *p_curtable, int *p_tex_padded) { int i; *p_tex_padded = wnet & 1; @@ -422,12 +424,13 @@ static void pdf_textprocess_end(int *chainemc, int *p_mclength, const int is_las /* 547 */ /* Text compaction */ -static void pdf_textprocess(int *chainemc, int *p_mclength, const unsigned char chaine[], const int start, +static void pdf_textprocess(short *chainemc, int *p_mclength, const unsigned char chaine[], const int start, const int length, const int lastmode, const int is_last_seg, int *p_curtable, int *p_tex_padded) { const int real_lastmode = PDF_REAL_MODE(lastmode); int j, indexlistet; int curtable = real_lastmode == PDF_TEX ? *p_curtable : T_ALPHA; /* Set default table upper alpha */ - int listet[2][PDF_MAX_LEN] = {{0}}, chainet[PDF_MAX_LEN]; + int listet[2][PDF_MAX_LEN] = {{0}}; + unsigned char chainet[PDF_MAX_STREAM_LEN]; int wnet = 0; /* add mode indicator if needed */ @@ -492,13 +495,13 @@ static void pdf_textprocess(int *chainemc, int *p_mclength, const unsigned char } /* Minimal text compaction */ -static void pdf_textprocess_minimal(int *chainemc, int *p_mclength, const unsigned char chaine[], +static void pdf_textprocess_minimal(short *chainemc, int *p_mclength, const unsigned char chaine[], int liste[3][PDF_MAX_LEN], const int indexliste, const int lastmode, const int is_last_seg, int *p_curtable, int *p_tex_padded, int *p_i) { const int real_lastmode = PDF_REAL_MODE(lastmode); int i, j, k; int curtable = real_lastmode == PDF_TEX ? *p_curtable : T_ALPHA; /* Set default table upper alpha */ - int chainet[PDF_MAX_LEN]; + unsigned char chainet[PDF_MAX_STREAM_LEN]; int wnet = 0; /* add mode indicator if needed */ @@ -550,7 +553,7 @@ static void pdf_textprocess_minimal(int *chainemc, int *p_mclength, const unsign /* 671 */ /* Byte compaction */ -INTERNAL void pdf_byteprocess(int *chainemc, int *p_mclength, const unsigned char chaine[], int start, +INTERNAL void pdf_byteprocess(short *chainemc, int *p_mclength, const unsigned char chaine[], int start, const int length, const int lastmode, const int debug_print) { const int real_lastmode = PDF_REAL_MODE(lastmode); @@ -611,7 +614,7 @@ INTERNAL void pdf_byteprocess(int *chainemc, int *p_mclength, const unsigned cha /* 712 */ /* Numeric compaction */ -static void pdf_numbprocess(int *chainemc, int *p_mclength, const unsigned char chaine[], const int start, +static void pdf_numbprocess(short *chainemc, int *p_mclength, const unsigned char chaine[], const int start, const int length) { int j; @@ -660,7 +663,7 @@ static void pdf_numbprocess(int *chainemc, int *p_mclength, const unsigned char } #ifdef ZINT_TEST /* Wrapper for direct testing */ -INTERNAL void pdf_numbprocess_test(int *chainemc, int *p_mclength, const unsigned char chaine[], const int start, +INTERNAL void pdf_numbprocess_test(short *chainemc, int *p_mclength, const unsigned char chaine[], const int start, const int length) { pdf_numbprocess(chainemc, p_mclength, chaine, start, length); } @@ -995,7 +998,7 @@ static int pdf_define_mode(int liste[3][PDF_MAX_LEN], int *p_indexliste, const u /* Initial processing of data, shared by `pdf417()` and `micropdf417()` */ static int pdf_initial(struct zint_symbol *symbol, const unsigned char chaine[], const int length, const int eci, const int is_micro, const int is_last_seg, int *p_lastmode, int *p_curtable, int *p_tex_padded, - int chainemc[PDF_MAX_LEN], int *p_mclength) { + short chainemc[PDF_MAX_STREAM_LEN], int *p_mclength) { int i, indexchaine = 0, indexliste = 0; int liste[3][PDF_MAX_LEN] = {{0}}; int mclength; @@ -1114,7 +1117,7 @@ static int pdf_initial(struct zint_symbol *symbol, const unsigned char chaine[], /* Call `pdf_initial()` for each segment, dealing with Structured Append beforehand */ static int pdf_initial_segs(struct zint_symbol *symbol, struct zint_seg segs[], const int seg_count, - const int is_micro, int chainemc[PDF_MAX_LEN], int *p_mclength, int structapp_cws[18], + const int is_micro, short chainemc[PDF_MAX_STREAM_LEN], int *p_mclength, int structapp_cws[18], int *p_structapp_cp) { int i; int error_number = 0; @@ -1197,7 +1200,8 @@ static int pdf_initial_segs(struct zint_symbol *symbol, struct zint_seg segs[], /* Encode PDF417 */ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int seg_count) { int i, j, longueur, loop, mccorrection[520] = {0}, offset; - int total, chainemc[PDF_MAX_LEN], mclength, c1, c2, c3, dummy[35]; + int total, mclength, c1, c2, c3, dummy[35]; + short chainemc[PDF_MAX_STREAM_LEN]; int rows, cols, ecc, ecc_cws, padding; char pattern[580]; int bp = 0; @@ -1376,7 +1380,7 @@ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int } #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) { - debug_test_codeword_dump_int(symbol, chainemc, mclength); + debug_test_codeword_dump_short(symbol, chainemc, mclength); } #endif @@ -1492,7 +1496,8 @@ INTERNAL int pdf417(struct zint_symbol *symbol, struct zint_seg segs[], const in /* like PDF417 only much smaller! */ INTERNAL int micropdf417(struct zint_symbol *symbol, struct zint_seg segs[], const int seg_count) { int i, k, j, longueur, mccorrection[50] = {0}, offset; - int total, chainemc[PDF_MAX_LEN], mclength, error_number = 0; + int total, mclength, error_number = 0; + short chainemc[PDF_MAX_STREAM_LEN]; char pattern[580]; int bp = 0; int structapp_cws[18] = {0}; /* 3 (Index) + 10 (ID) + 4 (Count) + 1 (Last) */ @@ -1729,7 +1734,7 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, struct zint_seg segs[], con } #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) { - debug_test_codeword_dump_int(symbol, chainemc, mclength); + debug_test_codeword_dump_short(symbol, chainemc, mclength); } #endif diff --git a/backend/pdf417.h b/backend/pdf417.h index f0578ea0..9946f206 100644 --- a/backend/pdf417.h +++ b/backend/pdf417.h @@ -56,7 +56,7 @@ INTERNAL_DATA_EXTERN const unsigned short pdf_rap_side[52]; /* Centre Row Address Pattern from Table 2 */ INTERNAL_DATA_EXTERN const unsigned short pdf_rap_centre[52]; -INTERNAL void pdf_byteprocess(int *chainemc, int *p_mclength, const unsigned char chaine[], int start, +INTERNAL void pdf_byteprocess(short *chainemc, int *p_mclength, const unsigned char chaine[], int start, const int length, const int lastmode, const int debug); /* vim: set ts=4 sw=4 et : */ diff --git a/backend/rss.c b/backend/rss.c index 4c54d2c1..29b9e093 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -810,10 +810,15 @@ INTERNAL int dbar_ltd(struct zint_symbol *symbol, unsigned char source[], int le } /* Check and convert date to DataBar date value */ -INTERNAL int dbar_date(const unsigned char source[], const int src_posn) { - int yy = to_int(source + src_posn, 2); - int mm = to_int(source + src_posn + 2, 2); - int dd = to_int(source + src_posn + 4, 2); +INTERNAL int dbar_date(const unsigned char source[], const int length, const int src_posn) { + int yy, mm, dd; + + if (src_posn + 4 + 2 > length) { + return -1; + } + yy = to_int(source + src_posn, 2); + mm = to_int(source + src_posn + 2, 2); + dd = to_int(source + src_posn + 4, 2); /* Month can't be zero but day can (means last day of month, GS1 General Specifications Sections 3.4.2 to 3.4.7) */ @@ -875,7 +880,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha } else if ((length == 34) && (source[26] == '1') && (source[27] == '1' || source[27] == '3' || source[27] == '5' || source[27] == '7') - && dbar_date(source, 28) >= 0) { + && dbar_date(source, length, 28) >= 0) { /* (01), (310x) and (11) - metric weight and production date */ /* (01), (310x) and (13) - metric weight and packaging date */ @@ -906,7 +911,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha } else if ((length == 34) && (source[26] == '1') && (source[27] == '1' || source[27] == '3' || source[27] == '5' || source[27] == '7') - && dbar_date(source, 28) >= 0) { + && dbar_date(source, length, 28) >= 0) { /* (01), (320x) and (11) - English weight and production date */ /* (01), (320x) and (13) - English weight and packaging date */ @@ -1031,7 +1036,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha if (length == 34) { /* Date information is included */ - group_val = dbar_date(source, 28); + group_val = dbar_date(source, length, 28); } else { group_val = 38400; } diff --git a/backend/tests/test_codablock.c b/backend/tests/test_codablock.c index e7f0c3c9..a8cf4e57 100644 --- a/backend/tests/test_codablock.c +++ b/backend/tests/test_codablock.c @@ -575,23 +575,42 @@ static void test_encode(const testCtx *const p_ctx) { testFinish(); } -/* #181 Christian Hartlage OSS-Fuzz */ +/* #181 Christian Hartlage OSS-Fuzz and #300 Andre Maute */ static void test_fuzz(const testCtx *const p_ctx) { int debug = p_ctx->debug; struct item { + int option_1; + int option_2; char *data; int length; int ret; + int bwipp_cmp; + char *comment; }; - /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { "\034\034I", 3, 0 }, + /* 0*/ { -1, -1, "\034\034I", 3, 0, 1, "" }, + /* 1*/ { 6, -2147483648, + "\134\000\377\153\143\163\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061" + "\071\065\062\000\000\000\000\061\061\061\061\061\061\366\366\366\366\366\366\366\366\366\366\007\366\366\366\366\366\366\366\061\061\061\061\061\061\061\061\061" + "\061\061\061\061\061\061\061\323\323\323\323\000\200\135\000\362\000\000\000\000\000\050\000\000\000\000\162\162\162\162\034\153\143\163\061\061\061\061\061\061" + "\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\312\061\061\061\061\061\061\061" + "\061\366\366\366\366\366\366\366\366\366\366\007\366\366\366\366\366\366\366\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\323\323\323\323\000" + "\200\135\000\362\362\362\362\000\167\027\000\000\000\000\000\000\000\000\000\167\167\167\167\000\000\000\154\000\043\000\000\000\000\000\000\000\000\153", + 238, 0, 0, "BWIPP different (better) encodation" + }, /* #300 (#9) Andre Maute */ }; int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; + char escaped[16834]; + char cmp_buf[32768]; + char cmp_msg[32768]; + + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */ + testStartSymbol("test_fuzz", &symbol); for (i = 0; i < data_size; i++) { @@ -601,11 +620,40 @@ static void test_fuzz(const testCtx *const p_ctx) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, BARCODE_CODABLOCKF, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); + length = testUtilSetSymbol(symbol, BARCODE_CODABLOCKF, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + if (ret < ZINT_ERROR) { + + if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) { + if (!data[i].bwipp_cmp) { + if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); + } else { + char modules_dump[32768]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump); + } + } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) { + int cmp_len, ret_len; + char modules_dump[32768]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } + } + ZBarcode_Delete(symbol); } diff --git a/backend/tests/test_code1.c b/backend/tests/test_code1.c index aaedc75d..911f928c 100644 --- a/backend/tests/test_code1.c +++ b/backend/tests/test_code1.c @@ -3353,6 +3353,7 @@ static void test_fuzz(const testCtx *const p_ctx) { int debug = p_ctx->debug; struct item { + int option_2; char *data; int length; int ret; @@ -3361,20 +3362,22 @@ static void test_fuzz(const testCtx *const p_ctx) { }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { "3333P33B\035333V3333333333333\0363", -1, 0, 1, "" }, /* #181 Nico Gunkel, OSS-Fuzz */ - /* 1*/ { "{{-06\024755712162106130000000829203983\377", -1, 0, 1, "" }, /* #232 Jan Schrewe, CI-Fuzz, out-of-bounds in is_last_single_ascii() sp + 1 */ - /* 2*/ { "\000\000\000\367\000\000\000\000\000\103\040\000\000\244\137\140\140\000\000\000\000\000\000\000\000\000\005\000\000\000\000\000\165\060\060\060\060\061\060\060\114\114\060\010\102\102\102\102\102\102\102\102\057\102\100\102\057\233\100\102", 60, 0, 1, "" }, /* #300 (#4) Andre Maute */ + /* 0*/ { -1, "3333P33B\035333V3333333333333\0363", -1, 0, 1, "" }, /* #181 Nico Gunkel, OSS-Fuzz */ + /* 1*/ { -1, "{{-06\024755712162106130000000829203983\377", -1, 0, 1, "" }, /* #232 Jan Schrewe, CI-Fuzz, out-of-bounds in is_last_single_ascii() sp + 1 */ + /* 2*/ { -1, "\000\000\000\367\000\000\000\000\000\103\040\000\000\244\137\140\140\000\000\000\000\000\000\000\000\000\005\000\000\000\000\000\165\060\060\060\060\061\060\060\114\114\060\010\102\102\102\102\102\102\102\102\057\102\100\102\057\233\100\102", 60, 0, 1, "" }, /* #300 (#4) Andre Maute */ + /* 3*/ { 10, "\153\153\153\060\001\000\134\153\153\015\015\353\362\015\015\015\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\362\362\000", 65, ZINT_ERROR_TOO_LONG, 1, "" }, /* #300 (#8) Andre Maute */ + /* 4*/ { 10, "\015\015\353\362\015\015\015\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\362\362\000", 39, 0, 1, "" }, /* #300 (#8 shortened) Andre Maute */ }; int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char bwipp_buf[32768]; char bwipp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ - testStart("test_fuzz"); + testStartSymbol("test_fuzz", &symbol); for (i = 0; i < data_size; i++) { @@ -3383,22 +3386,19 @@ static void test_fuzz(const testCtx *const p_ctx) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - symbol->symbology = BARCODE_CODEONE; - symbol->debug |= debug; - - length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; + length = testUtilSetSymbol(symbol, BARCODE_CODEONE, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); if (ret < ZINT_ERROR) { - if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) { + if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) { if (!data[i].bwipp_cmp) { if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); } else { char modules_dump[4096]; assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); - ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf), NULL); + ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf), NULL); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, modules_dump); diff --git a/backend/tests/test_composite.c b/backend/tests/test_composite.c index 1638e897..fd4a28d9 100644 --- a/backend/tests/test_composite.c +++ b/backend/tests/test_composite.c @@ -3457,12 +3457,13 @@ static void test_input(const testCtx *const p_ctx) { testFinish(); } -/* #181 Christian Hartlage OSS-Fuzz */ +/* #181 Christian Hartlage OSS-Fuzz and #300 Andre Maute */ static void test_fuzz(const testCtx *const p_ctx) { int debug = p_ctx->debug; struct item { int symbology; + int input_mode; char *data; int length; char *composite; @@ -3470,11 +3471,13 @@ static void test_fuzz(const testCtx *const p_ctx) { }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { BARCODE_EANX_CC, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG }, - /* 1*/ { BARCODE_UPCA_CC, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG }, - /* 2*/ { BARCODE_UPCE_CC, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG }, - /* 3*/ { BARCODE_EANX_CC, "+12345", -1, "[21]A12345678", 0 }, - /* 4*/ { BARCODE_EANX_CC, "+123456", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG }, + /* 0*/ { BARCODE_EANX_CC, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG }, + /* 1*/ { BARCODE_UPCA_CC, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG }, + /* 2*/ { BARCODE_UPCE_CC, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG }, + /* 3*/ { BARCODE_EANX_CC, -1, "+12345", -1, "[21]A12345678", 0 }, + /* 4*/ { BARCODE_EANX_CC, -1, "+123456", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG }, + /* 5*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, "kks", -1, "()111%", ZINT_ERROR_INVALID_DATA }, /* #300 (#5), Andre Maute */ + /* 6*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\153\153\153\153\153\153\153\153\163", -1, "()90", ZINT_ERROR_TOO_LONG }, /* #300 (#6), Andre Maute */ }; int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; @@ -3489,7 +3492,7 @@ static void test_fuzz(const testCtx *const p_ctx) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); assert_zero(length >= 128, "i:%d length %d >= 128\n", i, length); strcpy(symbol->primary, data[i].data); diff --git a/backend/tests/test_pdf417.c b/backend/tests/test_pdf417.c index 1ff09225..d1119e85 100644 --- a/backend/tests/test_pdf417.c +++ b/backend/tests/test_pdf417.c @@ -4782,13 +4782,16 @@ static void test_fuzz(const testCtx *const p_ctx) { struct item { int symbology; int input_mode; + int option_1; + int option_2; char *data; int length; - int option_1; int ret; + int bwipp_cmp; + char *comment; }; struct item data[] = { - /* 0*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, + /* 0*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, "\060\075\204\060\204\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075" "\204\060\075\060\103\204\060\214\060\204\060\075\060\031\060\073\060\025\060\075\060\204\060\103\204\060\075\060\204\060\000\075\060\226\060\100\204\060\204\060" "\204\060\075\204\060\120\214\060\204\060\074\377\060\075\204\060\075\060\103\204\060\214\060\204\060\075\060\041\060\000\060\204\060\120\214\060\204\060\074\204" @@ -4814,8 +4817,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075\204\060\075\060\103" "\204\060\214\060\204\060\075\060\073\060\075\060\204\060\103\204\060\075\060\204\060\204\060\122\060\000\060\075\060\000\076\060\100\000\060\004\060\103\204\060" "\204\060\003\060\204\075\060\120\214\060\204\060\004\060\103\204\060\204\060\003\060\211\074\060\120\060\124\060\351\060\120\060\075\060\351\060\072\375\060\204\060", - 1001, -1, ZINT_ERROR_TOO_LONG }, /* Original OSS-Fuzz triggering data */ - /* 1*/ { BARCODE_PDF417, DATA_MODE, + 1001, ZINT_ERROR_TOO_LONG, 1, "" + }, /* Original OSS-Fuzz triggering data */ + /* 1*/ { BARCODE_PDF417, DATA_MODE, -1, -1, "\060\075\204\060\204\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075" "\204\060\075\060\103\204\060\214\060\204\060\075\060\031\060\073\060\025\060\075\060\204\060\103\204\060\075\060\204\060\000\075\060\226\060\100\204\060\204\060" "\204\060\075\204\060\120\214\060\204\060\074\377\060\075\204\060\075\060\103\204\060\214\060\204\060\075\060\041\060\000\060\204\060\120\214\060\204\060\074\204" @@ -4841,8 +4845,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075\204\060\075\060\103" "\204\060\214\060\204\060\075\060\073\060\075\060\204\060\103\204\060\075\060\204\060\204\060\122\060\000\060\075\060\000\076\060\100\000\060\004\060\103\204\060" "\204\060\003\060\204\075\060\120\214\060\204\060\004\060\103\204\060\204\060\003\060\211\074\060\120\060\124\060\351\060\120\060\075\060\351\060\072\375\060\204\060", - 1001, -1, 0 }, /* Original OSS-Fuzz triggering data */ - /* 2*/ { BARCODE_PDF417COMP, DATA_MODE | FAST_MODE, + 1001, 0, 0, "BWIPP different encodation" + }, /* Original OSS-Fuzz triggering data */ + /* 2*/ { BARCODE_PDF417COMP, DATA_MODE | FAST_MODE, -1, -1, "\060\075\204\060\204\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075" "\204\060\075\060\103\204\060\214\060\204\060\075\060\031\060\073\060\025\060\075\060\204\060\103\204\060\075\060\204\060\000\075\060\226\060\100\204\060\204\060" "\204\060\075\204\060\120\214\060\204\060\074\377\060\075\204\060\075\060\103\204\060\214\060\204\060\075\060\041\060\000\060\204\060\120\214\060\204\060\074\204" @@ -4868,8 +4873,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075\204\060\075\060\103" "\204\060\214\060\204\060\075\060\073\060\075\060\204\060\103\204\060\075\060\204\060\204\060\122\060\000\060\075\060\000\076\060\100\000\060\004\060\103\204\060" "\204\060\003\060\204\075\060\120\214\060\204\060\004\060\103\204\060\204\060\003\060\211\074\060\120\060\124\060\351\060\120\060\075\060\351\060\072\375\060\204\060", - 1001, -1, ZINT_ERROR_TOO_LONG }, - /* 3*/ { BARCODE_PDF417COMP, DATA_MODE, + 1001, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 3*/ { BARCODE_PDF417COMP, DATA_MODE, -1, -1, "\060\075\204\060\204\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075" "\204\060\075\060\103\204\060\214\060\204\060\075\060\031\060\073\060\025\060\075\060\204\060\103\204\060\075\060\204\060\000\075\060\226\060\100\204\060\204\060" "\204\060\075\204\060\120\214\060\204\060\074\377\060\075\204\060\075\060\103\204\060\214\060\204\060\075\060\041\060\000\060\204\060\120\214\060\204\060\074\204" @@ -4895,8 +4901,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075\204\060\075\060\103" "\204\060\214\060\204\060\075\060\073\060\075\060\204\060\103\204\060\075\060\204\060\204\060\122\060\000\060\075\060\000\076\060\100\000\060\004\060\103\204\060" "\204\060\003\060\204\075\060\120\214\060\204\060\004\060\103\204\060\204\060\003\060\211\074\060\120\060\124\060\351\060\120\060\075\060\351\060\072\375\060\204\060", - 1001, -1, 0 }, - /* 4*/ { BARCODE_MICROPDF417, DATA_MODE | FAST_MODE, + 1001, 0, 0, "BWIPP different encodation" + }, + /* 4*/ { BARCODE_MICROPDF417, DATA_MODE | FAST_MODE, -1, -1, "\060\075\204\060\204\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075" "\204\060\075\060\103\204\060\214\060\204\060\075\060\031\060\073\060\025\060\075\060\204\060\103\204\060\075\060\204\060\000\075\060\226\060\100\204\060\204\060" "\204\060\075\204\060\120\214\060\204\060\074\377\060\075\204\060\075\060\103\204\060\214\060\204\060\075\060\041\060\000\060\204\060\120\214\060\204\060\074\204" @@ -4922,8 +4929,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075\204\060\075\060\103" "\204\060\214\060\204\060\075\060\073\060\075\060\204\060\103\204\060\075\060\204\060\204\060\122\060\000\060\075\060\000\076\060\100\000\060\004\060\103\204\060" "\204\060\003\060\204\075\060\120\214\060\204\060\004\060\103\204\060\204\060\003\060\211\074\060\120\060\124\060\351\060\120\060\075\060\351\060\072\375\060\204\060", - 1001, -1, ZINT_ERROR_TOO_LONG }, - /* 5*/ { BARCODE_MICROPDF417, DATA_MODE, + 1001, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 5*/ { BARCODE_MICROPDF417, DATA_MODE, -1, -1, "\060\075\204\060\204\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075" "\204\060\075\060\103\204\060\214\060\204\060\075\060\031\060\073\060\025\060\075\060\204\060\103\204\060\075\060\204\060\000\075\060\226\060\100\204\060\204\060" "\204\060\075\204\060\120\214\060\204\060\074\377\060\075\204\060\075\060\103\204\060\214\060\204\060\075\060\041\060\000\060\204\060\120\214\060\204\060\074\204" @@ -4949,8 +4957,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075\204\060\075\060\103" "\204\060\214\060\204\060\075\060\073\060\075\060\204\060\103\204\060\075\060\204\060\204\060\122\060\000\060\075\060\000\076\060\100\000\060\004\060\103\204\060" "\204\060\003\060\204\075\060\120\214\060\204\060\004\060\103\204\060\204\060\003\060\211\074\060\120\060\124\060\351\060\120\060\075\060\351\060\072\375\060\204\060", - 1001, -1, ZINT_ERROR_TOO_LONG }, - /* 6*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, + 1001, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 6*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, 0, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" @@ -4970,8 +4979,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890", - 2710, 0, 0 }, /* Max numerics with ECC 0 */ - /* 7*/ { BARCODE_PDF417, DATA_MODE, + 2710, 0, 0, "BWIPP different encodation" + }, /* Max numerics with ECC 0 */ + /* 7*/ { BARCODE_PDF417, DATA_MODE, 0, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" @@ -4991,8 +5001,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890", - 2710, 0, 0 }, /* Max numerics with ECC 0 */ - /* 8*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, + 2710, 0, 0, "BWIPP different encodation" + }, /* Max numerics with ECC 0 */ + /* 8*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, 0, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" @@ -5012,8 +5023,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "12345678901", - 2711, 0, ZINT_ERROR_TOO_LONG }, - /* 9*/ { BARCODE_PDF417, DATA_MODE, + 2711, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 9*/ { BARCODE_PDF417, DATA_MODE, 0, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" @@ -5033,8 +5045,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "12345678901", - 2711, 0, ZINT_ERROR_TOO_LONG }, - /*10*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, + 2711, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 10*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" @@ -5052,8 +5065,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", - 2528, -1, 0 }, /* Max numerics with ECC 5 */ - /*11*/ { BARCODE_PDF417, DATA_MODE, + 2528, 0, 0, "BWIPP different encodation" + }, /* Max numerics with ECC 5 */ + /* 11*/ { BARCODE_PDF417, DATA_MODE, -1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" @@ -5071,8 +5085,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", - 2528, -1, 0 }, /* Max numerics with ECC 5 */ - /*12*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, + 2528, 0, 0, "BWIPP different encodation" + }, /* Max numerics with ECC 5 */ + /* 12*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, 0, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -5088,8 +5103,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCD", - 1850, 0, 0 }, /* Max text with ECC 0 */ - /*13*/ { BARCODE_PDF417, DATA_MODE, + 1850, 0, 0, "BWIPP different encodation" + }, /* Max text with ECC 0 */ + /* 13*/ { BARCODE_PDF417, DATA_MODE, 0, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -5105,8 +5121,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCD", - 1850, 0, 0 }, /* Max text with ECC 0 */ - /*14*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, + 1850, 0, 0, "BWIPP different encodation" + }, /* Max text with ECC 0 */ + /* 14*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, 0, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -5122,8 +5139,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", - 1853, 0, ZINT_ERROR_TOO_LONG }, - /*15*/ { BARCODE_PDF417, DATA_MODE, + 1853, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 15*/ { BARCODE_PDF417, DATA_MODE, 0, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -5139,8 +5157,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", - 1853, 0, ZINT_ERROR_TOO_LONG }, - /*16*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, + 1853, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 16*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, 0, -1, "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" @@ -5169,8 +5188,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240", - 1108, 0, 0 }, /* Max bytes with ECC 0 */ - /*17*/ { BARCODE_PDF417, DATA_MODE, + 1108, 0, 0, "BWIPP different encodation" + }, /* Max bytes with ECC 0 */ + /* 17*/ { BARCODE_PDF417, DATA_MODE, 0, -1, "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" @@ -5199,8 +5219,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240", - 1108, 0, 0 }, /* Max bytes with ECC 0 */ - /*18*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, + 1108, 0, 0, "BWIPP different encodation" + }, /* Max bytes with ECC 0 */ + /* 18*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, 0, -1, "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" @@ -5229,8 +5250,9 @@ static void test_fuzz(const testCtx *const p_ctx) { "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240", - 1111, 0, ZINT_ERROR_TOO_LONG }, - /*19*/ { BARCODE_PDF417, DATA_MODE, + 1111, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 19*/ { BARCODE_PDF417, DATA_MODE, 0, -1, "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" @@ -5259,44 +5281,53 @@ static void test_fuzz(const testCtx *const p_ctx) { "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240", - 1111, 0, ZINT_ERROR_TOO_LONG }, - /*20*/ { BARCODE_MICROPDF417, DATA_MODE | FAST_MODE, + 1111, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 20*/ { BARCODE_MICROPDF417, DATA_MODE | FAST_MODE, -1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456", - 366, -1, 0 }, /* Max numerics */ - /*21*/ { BARCODE_MICROPDF417, DATA_MODE, + 366, 0, 1, "" + }, /* Max numerics */ + /* 21*/ { BARCODE_MICROPDF417, DATA_MODE, -1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456", - 366, -1, 0 }, /* Max numerics */ - /*22*/ { BARCODE_MICROPDF417, DATA_MODE | FAST_MODE, + 366, 0, 1, "" + }, /* Max numerics */ + /* 22*/ { BARCODE_MICROPDF417, DATA_MODE | FAST_MODE, -1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567", - 367, -1, ZINT_ERROR_TOO_LONG }, - /*23*/ { BARCODE_MICROPDF417, DATA_MODE, + 367, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 23*/ { BARCODE_MICROPDF417, DATA_MODE, -1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567", - 367, -1, ZINT_ERROR_TOO_LONG }, - /*24*/ { BARCODE_MICROPDF417, DATA_MODE | FAST_MODE, + 367, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 24*/ { BARCODE_MICROPDF417, DATA_MODE | FAST_MODE, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP", - 250, -1, 0 }, /* Max text */ - /*25*/ { BARCODE_MICROPDF417, DATA_MODE, + 250, 0, 1, "" + }, /* Max text */ + /* 25*/ { BARCODE_MICROPDF417, DATA_MODE, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP", - 250, -1, 0 }, /* Max text */ - /*26*/ { BARCODE_MICROPDF417, DATA_MODE | FAST_MODE, + 250, 0, 1, "" + }, /* Max text */ + /* 26*/ { BARCODE_MICROPDF417, DATA_MODE | FAST_MODE, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQ", - 251, -1, ZINT_ERROR_TOO_LONG }, - /*27*/ { BARCODE_MICROPDF417, DATA_MODE, + 251, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 27*/ { BARCODE_MICROPDF417, DATA_MODE, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQ", - 251, -1, ZINT_ERROR_TOO_LONG }, - /*28*/ { BARCODE_PDF417COMP, DATA_MODE | FAST_MODE, + 251, ZINT_ERROR_TOO_LONG, 1, "" + }, + /* 28*/ { BARCODE_PDF417COMP, DATA_MODE | FAST_MODE, 0, -1, "\000\000\000\377\377\010\002\000\000\033\005\031\000\000\002\000\000\000\000\101\101\101\101\101\101\101\101\000\000\000\000\000\000\000\374\000\101\101\101\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\323\000\000\000\000\000\010\000\000\000\000\165\000\000\000\000\000\000\000\000\000\000\000\000\056" "\000\000\000\000\000\000\000\000\000\000\100\000\000\101\101\101\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\323\000\000\000\000\000\010\000" @@ -5324,12 +5355,229 @@ static void test_fuzz(const testCtx *const p_ctx) { "\101\000\000\000\000\374\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\323\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\323\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000", - 1048, 0, 0 }, /* #300 (#1) Andre Maute */ + 1048, 0, 0, "BWIPP different encodation" + }, /* #300 (#1) Andre Maute */ + /* 29*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, + "\060\060\060\060\060\060\060\060\060\060\060\162\162\162\162\162\162\162\162\162\162\047\122\162\000\000\167\211\206\001\000\047\153\153\153\153\153\067\066\164" + "\060\060\060\060\060\060\060\060\060\060\060\162\162\162\162\162\162\162\162\162\162\047\122\162\000\000\167\211\206\001\000\047\153\153\153\153\153\153\153\164" + "\164\164\164\164\164\124\164\164\164\164\164\164\164\164\164\164\164\164\164\164\060\060\060\060\060\060\060\060\060\060\060\162\162\162\162\162\162\162\162\162" + "\162\047\122\162\162\162\162\162\162\162\167\167\167\162\162\162\162\047\122\162\000\000\167\167\167\001\152\152\152\152\152\152\051\050\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\107\107\107\107\107\107\107\107" + "\107\107\162\107\107\107\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\152\152\152\152\152" + "\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152" + "\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050" + "\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051" + "\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152" + "\152\152\051\050\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051" + "\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152" + "\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051\051\051\051\051\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051" + "\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107" + "\107\107\107\107\152\051\051\051\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051" + "\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152" + "\152\152\152\152\152\107\107\107\107\107\152\051\051\051\152\051\050\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\107\107\107\152" + "\051\051\051\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152" + "\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\050\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051" + "\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152" + "\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\050\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\107\107\107\152\051" + "\051\051\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051" + "\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107" + "\107\107\107\107\152\051\051\051\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\050\152" + "\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152" + "\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\050\051\051\051\051\050\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051" + "\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051" + "\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152" + "\152\152\152\152\152\152\152\152\107\107\107\107\107\152\051\051\051\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\000\124\164\164\162\162\162\047\122\162\162" + "\162\162\001\100\167\167\001\044\204\167\167", + 2611, ZINT_ERROR_TOO_LONG, 1, "" + }, /* #300 (#7) Andre Maute */ + /* 30*/ { BARCODE_PDF417, DATA_MODE, -1, -1, + "\060\060\060\060\060\060\060\060\060\060\060\162\162\162\162\162\162\162\162\162\162\047\122\162\000\000\167\211\206\001\000\047\153\153\153\153\153\067\066\164" + "\060\060\060\060\060\060\060\060\060\060\060\162\162\162\162\162\162\162\162\162\162\047\122\162\000\000\167\211\206\001\000\047\153\153\153\153\153\153\153\164" + "\164\164\164\164\164\124\164\164\164\164\164\164\164\164\164\164\164\164\164\164\060\060\060\060\060\060\060\060\060\060\060\162\162\162\162\162\162\162\162\162" + "\162\047\122\162\162\162\162\162\162\162\167\167\167\162\162\162\162\047\122\162\000\000\167\167\167\001\152\152\152\152\152\152\051\050\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\107\107\107\107\107\107\107\107" + "\107\107\162\107\107\107\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\152\152\152\152\152" + "\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152" + "\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050" + "\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051" + "\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152" + "\152\152\051\050\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051" + "\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152" + "\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051\051\051\051\051\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051" + "\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107" + "\107\107\107\107\152\051\051\051\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051" + "\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152" + "\152\152\152\152\152\107\107\107\107\107\152\051\051\051\152\051\050\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\107\107\107\152" + "\051\051\051\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152" + "\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\050\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051" + "\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152" + "\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\050\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\107\107\107\152\051" + "\051\051\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051" + "\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107" + "\107\107\107\107\152\051\051\051\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\051\051\051\050\152" + "\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152" + "\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\050\051\051\051\051\050\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051" + "\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051" + "\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152" + "\152\152\152\152\152\152\152\152\107\107\107\107\107\152\051\051\051\051\107\107\107\107\107\107\107\107\107\107\107\051\051\051\051\051\051\050\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\051\152\152\152\152\152\152\152\152\152\152\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051" + "\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\051\051\050\152\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\152\152\051\051\051\051\051\051\051\051\051" + "\051\051\051\051\107\107\051\051\051\051\051\051\051\051\051\051\051\051\050\051\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051" + "\051\051\050\152\152\152\152\152\152\152\152\051\050\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\051\000\124\164\164\162\162\162\047\122\162\162" + "\162\162\001\100\167\167\001\044\204\167\167", + 2611, ZINT_ERROR_TOO_LONG, 1, "" + }, /* #300 (#7) Andre Maute !FAST_MODE */ + /* 31*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, 242, + "\000\000\000\000\000\000\000\000\000\000\000\212\377\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153\000\153\153\137\377\153\153\000\134\000\000" + "\000\153\153\343\153\153\153\060\047\047\043\047\057\157\153\153\153\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\377\377\377\167" + "\001\100\000\377\004\002\000\000\000\000\000\001\000\000\134\077\162\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162" + "\077\162\072\176\000\162\362\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162\364\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362" + "\134\162\162\162\072\176\000\215\215\162\162\162\174\174\174\174\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077" + "\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\162\162\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362\377\134\134\126\142\134" + "\162\362\162\162\162\072\176\000\162\134\134\126\142\134\162\362\162\162\162\072\176\000\162\162\162\162\162\174\174\377\134\362\162\362\162\162\162\072\176\000" + "\162\362\162\162\162\174\174\377\134\134\134\162\142\362\134\162\162\162\072\176\000\000\044\162\162\162\162\174\174\377\134\362\162\162\162\134\134\134\142\162" + "\072\176\000\215\215\162\162\162\174\174\174\174\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000" + "\162\162\377\377\377\377\377\377\134\134\134\142\134\162\153\153\153\153\153\153\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134" + "\134\134\142\134\162\362\162\162\162\072\176\000\162\000\001\000\000\134\077\162\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162" + "\162\162\162\077\162\072\176\000\162\362\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162\364\072\176\000\162\162\162\162\162\174\174\377\134\134\134" + "\162\142\362\134\162\162\162\072\176\000\215\215\162\162\162\174\174\174\174\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162" + "\162\162\077\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\162\162\072" + "\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362\377\134\134\126\142\134\162\362\162\162\162\072\176\000\174\174\377\134\362\162\362\162\162\162" + "\072\176\000\162\362\162\162\162\174\174\377\134\134\134\162\142\362\134\162\162\162\072\176\000\162\362\162\162\162\134\134\134\142\134\162\162\162\162\077\173" + "\153\153\153\165\000\000\000\153\151\153\153\153\153\153\153\153\153\153\153\153\153\153\153\176\000\162\362\377\377\377\377\377\377\134\134\134\142\134\162\362" + "\162\162\162\072\176\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\142\134\162\362" + "\162\162\162\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362\377\134\134\134\167\167\167\167\167\001\100\000\002\000\000\000\000\000\000\000" + "\000\153\153\067\000\000\000\153\153\300\000\000\000\000\000\000\000\000\000\000\000\000\212\377\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153" + "\000\153\153\137\377\153\153\000\134\000\000\000\153\153\343\153\153\153\060\047\047\043\047\057\157\153\153\153\162\162\077\162\072\176\000\162\134\142\134\162" + "\162\162\162\077\162\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\377\377\377\167\001\100\000\377\004\002\000\000\000\000" + "\000\001\000\000\134\077\162\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\362\377\377\377" + "\377\377\377\134\134\134\142\134\162\362\162\162\364\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362\134\162\162\162\072\176\000\215\215\162" + "\162\162\174\174\174\174\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377" + "\377\377\134\134\134\162\162\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362\377\134\134\126\142\134\162\362\162\162\162\072\176\000\162\162" + "\162\162\162\174\174\377\134\362\162\362\162\162\162\072\176\000\162\362\162\162\162\174\174\377\134\134\134\162\142\362\134\162\162\162\072\176\000\000\044\162" + "\162\162\162\174\174\377\134\362\162\162\162\134\134\134\142\162\072\176\000\215\215\162\162\162\174\174\174\174\072\176\000\162\162\162\162\162\162\377\053\377" + "\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\142\134\162\153\153\153\153\153\153\142\134\162\162" + "\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162\162\072\176\000\162\000\001\000\000\134\077\162\072\176\000\162" + "\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\362\377\377\377\377\377\377\134\134\134\142\134\162\362\162" + "\162\364\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362\134\162\162\162\072\176\000\215\215\162\162\162\174\174\174\174\072\176\000\162\162" + "\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\162\162\072\176\000\162" + "\162\162\162\162\174\174\377\134\134\134\142\134\162\362\162\162\162\072\176\000\162\162\162\162\162\174\174\377\134\362\162\172\162\134\134\134\142\162\072\162" + "\162\162\162\174\174\377\134\362\162\362\162\162\162\072\176\000\162\362\162\162\162\174\174\377\134\134\134\162\142\362\134\162\162\162\072\176\000\000\044\162" + "\162\162\162\174\174\377\134\362\162\162\162\134\134\134\142\162\072\176\000\215\215\162\162\162\174\174\174\174\072\176\000\162\162\162\162\162\162\377\053\377" + "\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\142\134\162\153\153\153\153\153\153\142\134\162\162" + "\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162\162\072\176\000\162\000\001\000\000\134\077\162\072\176\000\162" + "\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\362\377\377\377\377\377\377\134\134\134\142\134\162\362\162" + "\162\364\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362\134\162\162\162\072\176\000\215\215\162\162\162\174\174\174\174\072\176\000\162\162" + "\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072" + "\176\000\162\162\377\377\377\377\377\377\134\134\134\162\162\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362\377\134\134\126\142\134\162\362" + "\162\162\162\072\176\000\174\174\377\134\362\162\362\162\162\162\072\176\000\162\362\162\162\162\174\174\377\134\134\134\162\142\362\134\162\162\162\072\176\000" + "\162\362\162\162\162\134\134\134\142\134\162\162\162\162\077\173\153\153\153\165\000\000\000\153\151\153\153\153\153\153\153\153\153\153\153\153\153\153\153\176" + "\000\162\362\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162\162\072\176\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176" + "\000\162\162\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162\162\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362\377\134\134\134" + "\167\167\167\167\167\001\100\000\002\000\000\000\000\000\000\000\000\153\153\067\000\000\000\153\153\300\000\000\000\000\000\000\000\000\000\000\000\000\212\377" + "\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153\000\153\153\137\377\153\153\000\134\000\000\000\153\153\343\153\153\153\060\047\047\043\047\057" + "\157\153\153\153\162\162\077\162\072\176\000\162\134\142\134\162\162\162\162\077\162\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134" + "\162\162\377\377\377\167\001\100\000\377\004\002\000\000\000\000\000\001\000\000\134\077\162\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134" + "\142\134\162\162\162\162\077\162\072\176\000\162\362\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162\364\072\176\000\162\162\162\162\162\174\174\377" + "\134\134\134\162\142\362\134\162\162\162\072\176\000\215\215\162\162\162\174\174\174\174\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142" + "\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\162\162\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362" + "\377\134\134\126\142\134\162\362\162\162\162\072\176\000\162\162\162\162\162\174\174\377\134\362\162\362\162\162\162\072\176\000\162\362\162\162\162\174\174\377" + "\134\134\134\162\142\362\134\162\162\162\072\176\000\000\044\162\162\162\162\174\174\377\134\362\162\162\162\134\134\134\142\162\072\176\000\215\215\162\162\162" + "\174\174\174\174\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377" + "\134\134\134\142\134\162\153\153\153\153\153\153\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162" + "\162\072\176\000\162\000\001\000\000\134\077\162\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000" + "\162\362\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162\364\072\176\000\162\162\162\162\162\174\174\377\134\134\134\162\142\362\134\162\162\162\072" + "\176\000\215\215\162\162\162\174\174\174\174\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162" + "\162\377\377\377\377\377\377\134\134\134\162\162\072\176\000\162\162\162\162\162\174\174\377\134\134\134\142\134\162\362\162\162\162\072\176\000\162\162\162\162" + "\162\174\174\377\134\362\162\172\162\134\134\134\142\162\072\176\000\215\215\162\162\162\174\174\174\171\072\176\000\162\162\162\162\162\162\377\053\377\377\377" + "\134\134\134\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162\162\072\176\000\162\362\162\162\162" + "\174\174\377\134\134\134\162\142\362\134\162\162\162\072\176\000\162\362\162\162\162\134\134\142\134\162\362\162\162\162\072\176\000\044\162\162\162\162\174\174" + "\377\134\362\162\162\162\134\134\134\142\162\072\176\000\215\215\162\162\162\174\174\174\174\072\176\000\162\162\162\162\162\162\377\053\377\377\377\134\134\134" + "\142\134\162\162\162\162\077\162\072\176\000\162\162\377\377\377\377\377\377\134\134\134\142\134\162\362\162\162\162\072\176\000\162\162\162\162\162\174\174\377" + "\134\134\134\162\142\362\134\162\162\162\072\176\000\215\215\162\162\162\174\174\174\174\134\134\134\142\134\000\153\153\153\153\153\153\153\062\047\047\043\047" + "\057\262\054\377\134\134\142\153\330\153", + 2690, ZINT_ERROR_TOO_LONG, 1, "" + }, /* #300 (#10) Andre Maute */ }; int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; + char escaped[16834]; + char cmp_buf[32768]; + char cmp_msg[32768]; + + int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ + int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */ + testStartSymbol("test_fuzz", &symbol); for (i = 0; i < data_size; i++) { @@ -5339,36 +5587,54 @@ static void test_fuzz(const testCtx *const p_ctx) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - symbol->symbology = data[i].symbology; - if (data[i].input_mode != -1) { - symbol->input_mode = data[i].input_mode; - } - if (data[i].option_1 != -1) { - symbol->option_1 = data[i].option_1; - } - symbol->debug |= debug; - - length = data[i].length; - if (length == -1) { - length = (int) strlen(data[i].data); - } + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + if (ret < ZINT_ERROR) { + + if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) { + if (!data[i].bwipp_cmp) { + if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); + } else { + char modules_dump[32768]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL); + assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump); + assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump); + } + } + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) { + int cmp_len, ret_len; + char modules_dump[32768]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len); + assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); + + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len); + assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n", + i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped); + } + } + ZBarcode_Delete(symbol); } testFinish(); } -INTERNAL void pdf_numbprocess_test(int *chainemc, int *p_mclength, const unsigned char chaine[], const int start, + +INTERNAL void pdf_numbprocess_test(short *chainemc, int *p_mclength, const unsigned char chaine[], const int start, const int length); #include "../large.h" /* Max codewords 12 */ -static int annex_d_decode_dump(int chainemc[], int mclength, unsigned char *chaine, int length, char *buf1, char *buf2) { +static int annex_d_decode_dump(short chainemc[], int mclength, unsigned char *chaine, int length, char *buf1, char *buf2) { static const large_uint pow900s[] = { { 0x1, 0 }, /*1*/ { 0x384, 0 }, /*900*/ @@ -5494,7 +5760,7 @@ static void test_numbprocess(const testCtx *const p_ctx) { int data_size = ARRAY_SIZE(data); int i, length; - int chainemc[32]; + short chainemc[32]; int mclength; testStart("test_numbprocess"); diff --git a/backend/tests/tools/run_bwipp_tests.sh b/backend/tests/tools/run_bwipp_tests.sh index dcf4ae03..421fef6e 100755 --- a/backend/tests/tools/run_bwipp_tests.sh +++ b/backend/tests/tools/run_bwipp_tests.sh @@ -22,6 +22,7 @@ run_bwipp_test "test_bc412" run_bwipp_test "test_channel" "encode" run_bwipp_test "test_codablock" "input" run_bwipp_test "test_codablock" "encode" +run_bwipp_test "test_codablock" "fuzz" run_bwipp_test "test_code" "encode" run_bwipp_test "test_code1" "encode" run_bwipp_test "test_code1" "encode_segs" @@ -51,6 +52,7 @@ run_bwipp_test "test_medical" "encode" run_bwipp_test "test_pdf417" "input" run_bwipp_test "test_pdf417" "encode" run_bwipp_test "test_pdf417" "encode_segs" +run_bwipp_test "test_pdf417" "fuzz" run_bwipp_test "test_plessey" "encode" run_bwipp_test "test_postal" "input" run_bwipp_test "test_postal" "encode" diff --git a/backend/tests/tools/run_zxingcpp_tests.sh b/backend/tests/tools/run_zxingcpp_tests.sh index 8cb4f6ce..039484d0 100755 --- a/backend/tests/tools/run_zxingcpp_tests.sh +++ b/backend/tests/tools/run_zxingcpp_tests.sh @@ -20,6 +20,7 @@ run_zxingcpp_test "test_aztec" "encode_segs" run_zxingcpp_test "test_aztec" "fuzz" run_zxingcpp_test "test_codablock" "input" run_zxingcpp_test "test_codablock" "encode" +run_zxingcpp_test "test_codablock" "fuzz" run_zxingcpp_test "test_code" "encode" run_zxingcpp_test "test_code128" "input" run_zxingcpp_test "test_code128" "encode" @@ -43,6 +44,7 @@ run_zxingcpp_test "test_pdf417" "reader_init" run_zxingcpp_test "test_pdf417" "input" run_zxingcpp_test "test_pdf417" "encode" run_zxingcpp_test "test_pdf417" "encode_segs" +run_zxingcpp_test "test_pdf417" "fuzz" run_zxingcpp_test "test_qr" run_zxingcpp_test "test_rss" "binary_div_modulo_divisor" run_zxingcpp_test "test_rss" "examples"