mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-27 21:44:13 -04:00
Consistently throw an error if data does not fit in specified size symbol
See ticket #57
This commit is contained in:
parent
ff6995070b
commit
5acbffff0d
5 changed files with 23 additions and 4 deletions
|
@ -1632,6 +1632,11 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||
version = symbol->option_2;
|
||||
est_binlen = getBinaryLength(symbol->option_2, mode, jisdata, length, gs1, symbol->eci);
|
||||
}
|
||||
|
||||
if (symbol->option_2 < version) {
|
||||
strcpy(symbol->errtxt, "Input too long for selected symbol size");
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure maxium error correction capacity */
|
||||
|
@ -2791,6 +2796,9 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||
if ((symbol->option_2 >= 1) && (symbol->option_2 <= 4)) {
|
||||
if (symbol->option_2 >= autoversion) {
|
||||
version = symbol->option_2;
|
||||
} else {
|
||||
strcpy(symbol->errtxt, "Input too long for selected symbol size");
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue