mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-12 22:25:59 -04:00
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
This commit is contained in:
parent
77c1ef1139
commit
a14fe77aa0
17 changed files with 561 additions and 193 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue