mirror of
https://git.code.sf.net/p/zint/code
synced 2025-12-18 18:37:07 +00:00
Stop crashing with large DotCode symbols
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user