From 542fed1d4fd2ef25ae378206de8bc0acbc07c1c6 Mon Sep 17 00:00:00 2001 From: gitlost Date: Sat, 26 Jun 2021 00:27:04 +0100 Subject: [PATCH] DATAMATRIX: strip extra precision in loop also (#228); AZTEC: move assert after error check (#229) --- backend/aztec.c | 2 +- backend/dmatrix.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/aztec.c b/backend/aztec.c index 3ba3454f..5e72d6e7 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -867,12 +867,12 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt } error_number = aztec_text_process(source, length, binary_string, gs1, symbol->eci, &data_length, debug); - assert(data_length > 0); /* Suppress clang-tidy warning: clang-analyzer-core.UndefinedBinaryOperatorResult */ if (error_number != 0) { strcpy(symbol->errtxt, "502: Input too long or too many extended ASCII characters"); return error_number; } + assert(data_length > 0); /* Suppress clang-tidy warning: clang-analyzer-core.UndefinedBinaryOperatorResult */ if (!((symbol->option_1 >= -1) && (symbol->option_1 <= 4))) { strcpy(symbol->errtxt, "503: Invalid error correction level - using default instead"); diff --git a/backend/dmatrix.c b/backend/dmatrix.c index c26727fe..413913fa 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -373,6 +373,13 @@ static int look_ahead_test(const unsigned char inputData[], const int sourcelen, /* At least 5 data characters processed ... step (r) */ /* NOTE: different than spec, where it's at least 4. Following previous behaviour here (and BWIPP) */ + ascii_count = stripf(ascii_count); + b256_count = stripf(b256_count); + edf_count = stripf(edf_count); + text_count = stripf(text_count); + x12_count = stripf(x12_count); + c40_count = stripf(c40_count); + cnt_1 = ascii_count + 1.0f; if (cnt_1 <= b256_count && cnt_1 <= edf_count && cnt_1 <= text_count && cnt_1 <= x12_count && cnt_1 <= c40_count) {