mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-14 15:14:49 -04:00
Stop crashing with large DotCode symbols
This commit is contained in:
parent
9d1c20201d
commit
3b366bbbd2
1 changed files with 17 additions and 5 deletions
|
@ -1083,6 +1083,11 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((height > 177) || (width > 177)) {
|
||||
strcpy(symbol->errtxt, "Specified symbol size is too large");
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
n_dots = (height * width) / 2;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
|
@ -1107,6 +1112,13 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||
data_length++;
|
||||
}
|
||||
|
||||
if (data_length > 450) {
|
||||
// Larger data sets than this cause rsencode() to throw SIGSEGV
|
||||
// This should probably be fixed by somebody who understands what rsencode() does...
|
||||
strcpy(symbol->errtxt, "Input too long");
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
ecc_length = 3 + (data_length / 2);
|
||||
|
||||
/* Evaluate data mask options */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue