mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Don't initialise roots beyond end of field
AKA don't use code from draft standards without testing it! Bug reported by Christian Sakowski
This commit is contained in:
parent
c0f6139f86
commit
ecb10e6b7d
@ -184,7 +184,7 @@ void rsencode(int nd, int nc, unsigned char *wd) {
|
||||
|
||||
// Start by generating "nc" roots (antilogs):
|
||||
root[0] = 1;
|
||||
for (i = 1; i <= nc; i++)
|
||||
for (i = 1; (i <= nc) && (i < GF); i++)
|
||||
root[i] = (PM * root[i - 1]) % GF;
|
||||
|
||||
// Here we compute how many interleaved R-S blocks will be needed
|
||||
@ -1121,13 +1121,6 @@ int dotcode(struct zint_symbol *symbol, const 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 (E21)");
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
|
||||
ecc_length = 3 + (data_length / 2);
|
||||
|
||||
/* Evaluate data mask options */
|
||||
|
Loading…
Reference in New Issue
Block a user