mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-27 13:34:19 -04:00
QRCODE: fix out-of-bounds crash due to incorrect mode costings for
GS1 percents in `qr_in_alpha()`, ticket #300, props Andre Maute; also defensively re-calc version 40 mode to prevent possible further crashes common: move `debug_print_escape()` from library to common
This commit is contained in:
parent
db92c7de57
commit
888db0bf00
13 changed files with 445 additions and 205 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2019-2022 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2019-2023 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
|
@ -69,11 +69,11 @@ static void test_large(const testCtx *const p_ctx) {
|
|||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
char data_buf[2755 + 1];
|
||||
|
||||
testStart("test_large");
|
||||
testStartSymbol("test_large", &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -142,9 +142,9 @@ static void test_options(const testCtx *const p_ctx) {
|
|||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStart("test_options");
|
||||
testStartSymbol("test_options", &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -319,11 +319,11 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
char escaped[1024];
|
||||
|
||||
testStart("test_input");
|
||||
testStartSymbol("test_input", &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -344,7 +344,8 @@ static void test_input(const testCtx *const p_ctx) {
|
|||
|
||||
if (p_ctx->generate) {
|
||||
printf(" /*%3d*/ { %s, %d, %s, %s, { %d, %d, \"%s\" }, \"%s\", %s, %d, \"%s\", \"%s\" },\n",
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].eci, testUtilOutputOptionsName(data[i].output_options), testUtilOption3Name(data[i].option_3),
|
||||
i, testUtilInputModeName(data[i].input_mode), data[i].eci, testUtilOutputOptionsName(data[i].output_options),
|
||||
testUtilOption3Name(BARCODE_GRIDMATRIX, data[i].option_3),
|
||||
data[i].structapp.index, data[i].structapp.count, data[i].structapp.id,
|
||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
|
||||
testUtilErrorName(data[i].ret), ret < ZINT_ERROR ? symbol->eci : -1, symbol->errtxt, data[i].comment);
|
||||
|
@ -476,9 +477,9 @@ static void test_encode(const testCtx *const p_ctx) {
|
|||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
struct zint_symbol *symbol;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
testStart("test_encode");
|
||||
testStartSymbol("test_encode", &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
@ -811,11 +812,11 @@ static void test_encode_segs(const testCtx *const p_ctx) {
|
|||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, j, seg_count, ret;
|
||||
struct zint_symbol *symbol;
|
||||
struct zint_symbol *symbol = NULL;
|
||||
|
||||
char escaped[8192];
|
||||
|
||||
testStart("test_encode_segs");
|
||||
testStartSymbol("test_encode_segs", &symbol);
|
||||
|
||||
for (i = 0; i < data_size; i++) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue