1
0
Fork 0
mirror of https://git.code.sf.net/p/zint/code synced 2025-05-29 22:35:27 -04:00

UPCA_CC/EANX_CC: fix out-of-bounds crash in AI resolve loop in

`gs1_verify()` by checking length before `to_int()`, ticket
   (), props Andre Maute
CODEONE: fix out-of-bounds crash for Version T by upping buffer
  size to same as for A to H, ticket  (), props Andre Maute
GS1_128_CC: fix divide-by-zero crash in `calc_padding_ccc()` by
  allowing for min linear width 68 in `cc_width` calc, ticket 
  (), props Andre Maute
BWIPP: update `bwipp_dump.ps` to latest version, update
  `gen_gs1_lint.php` to accommodate `req` "+"
PDF417: change `liste[]` int -> short to lessen stack usage
Some variable name and code fiddlings
This commit is contained in:
gitlost 2023-11-28 08:58:56 +00:00
parent e9203439b7
commit db92c7de57
11 changed files with 132 additions and 89 deletions
backend

View file

@ -37,6 +37,9 @@
#include "reedsol.h"
#include "large.h"
#define C1_MAX_CWS 1480 /* Max data codewords for Version H */
#define C1_MAX_ECCS 560 /* Max ECC codewords for Version H */
#define C1_ASCII 1
#define C1_C40 2
#define C1_DECIMAL 3
@ -851,7 +854,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
}
}
if (tp > 1480) {
if (tp > C1_MAX_CWS) {
if (debug_print) fputc('\n', stdout);
/* Data is too large for symbol */
return 0;
@ -953,7 +956,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
}
/* Re-check length of data */
if (tp > 1480) {
if (tp > C1_MAX_CWS) {
/* Data is too large for symbol */
return 0;
}
@ -1135,7 +1138,7 @@ INTERNAL int codeone(struct zint_symbol *symbol, struct zint_seg segs[], const i
} else if (symbol->option_2 == 10) {
/* Version T */
unsigned int target[90 + 2]; /* Allow for 90 BYTE mode (+ latch and byte count) */
unsigned int target[C1_MAX_CWS + C1_MAX_ECCS]; /* Use same buffer size as A to H to avail of loop checks */
unsigned int ecc[22];
int data_length;
int data_cw, ecc_cw, block_width;
@ -1221,7 +1224,7 @@ INTERNAL int codeone(struct zint_symbol *symbol, struct zint_seg segs[], const i
} else {
/* Versions A to H */
unsigned int target[1480 + 560];
unsigned int target[C1_MAX_CWS + C1_MAX_ECCS];
unsigned int sub_data[185], sub_ecc[70];
int data_length;
int data_cw;