mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-23 19:46:56 -04:00
CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow
RMQR: update to new draft ISO/IEC JTC1/SC31N000 (Draft 2019-6-24); allow for righthand vertical timing pattern in populate_grid() ULTRA: update max size and min cols based on BWIPP 2021-07-14 update backend_tcl/zint_tcl.dsp: use /MD instead of /MT for tcl lib compat; change include/lib path to more standard one manual.txt: highlight that rMQR is still in development GUI: use cross-platform smaller font func instead of explicit values for notes
This commit is contained in:
parent
4d0fff7cf5
commit
14d1140d09
49 changed files with 1828 additions and 739 deletions
|
@ -66,6 +66,7 @@ INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], int len
|
|||
strcpy(symbol->errtxt, "371: Invalid character in data (digits and \"ABCDEF\" only)");
|
||||
return error_number;
|
||||
}
|
||||
|
||||
if (!(checkptr = (unsigned char *) calloc(1, length * 4 + 8))) {
|
||||
strcpy(symbol->errtxt, "373: Insufficient memory for check digit CRC buffer");
|
||||
return ZINT_ERROR_MEMORY;
|
||||
|
@ -128,10 +129,8 @@ static char msi_check_digit_mod10(const unsigned char source[], const int length
|
|||
int i, x = 0, undoubled = 0;
|
||||
|
||||
for (i = length - 1; i >= 0; i--) {
|
||||
/* Note overflow impossible for max length 65 * max weight 9 * max val 15 == 8775 */
|
||||
x += vals[undoubled][ctoi(source[i])];
|
||||
if (x > 32767 - 20) {
|
||||
x %= 10; /* Prevent overflow */
|
||||
}
|
||||
undoubled = !undoubled;
|
||||
}
|
||||
|
||||
|
@ -144,10 +143,8 @@ static char msi_check_digit_mod11(const unsigned char source[], const int length
|
|||
int i, x = 0, weight = 2;
|
||||
|
||||
for (i = length - 1; i >= 0; i--) {
|
||||
/* Note overflow impossible for max length 65 * max weight 9 * max val 15 == 8775 */
|
||||
x += weight * ctoi(source[i]);
|
||||
if (x > 32767 - 200) {
|
||||
x %= 11; /* Prevent overflow */
|
||||
}
|
||||
weight++;
|
||||
if (weight > wrap) {
|
||||
weight = 2;
|
||||
|
@ -299,17 +296,16 @@ INTERNAL int msi_handle(struct zint_symbol *symbol, unsigned char source[], int
|
|||
int check_option = symbol->option_2;
|
||||
int no_checktext = 0;
|
||||
|
||||
if (length > 65) {
|
||||
strcpy(symbol->errtxt, "372: Input too long (65 character maximum)");
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
error_number = is_sane(NEON, source, length);
|
||||
if (error_number != 0) {
|
||||
strcpy(symbol->errtxt, "377: Invalid character in data (digits only)");
|
||||
return ZINT_ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if (length > 65) {
|
||||
strcpy(symbol->errtxt, "372: Input too long (65 character maximum)");
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
if (check_option >= 11 && check_option <= 16) { /* +10 means don't print check digits in HRT */
|
||||
check_option -= 10;
|
||||
no_checktext = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue