mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Ensure ECI encoding doesn't corrupt binary data in Data Matrix
Fixes #105 reported by Daniel Gredler
This commit is contained in:
parent
8fcde380f8
commit
23a990c37c
@ -581,12 +581,14 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
|
||||
if (symbol->eci <= 126) {
|
||||
target[tp] = (unsigned char) symbol->eci + 1;
|
||||
tp++;
|
||||
strcat(binary, " ");
|
||||
}
|
||||
if ((symbol->eci >= 127) && (symbol->eci <= 16382)) {
|
||||
target[tp] = (unsigned char) ((symbol->eci - 127) / 254) + 128;
|
||||
tp++;
|
||||
target[tp] = (unsigned char) ((symbol->eci - 127) % 254) + 1;
|
||||
tp++;
|
||||
strcat(binary, " ");
|
||||
}
|
||||
if (symbol->eci >= 16383) {
|
||||
target[tp] = (unsigned char) ((symbol->eci - 16383) / 64516) + 192;
|
||||
@ -595,6 +597,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
|
||||
tp++;
|
||||
target[tp] = (unsigned char) ((symbol->eci - 16383) % 254) + 1;
|
||||
tp++;
|
||||
strcat(binary, " ");
|
||||
}
|
||||
if (debug) printf("ECI %d ", symbol->eci + 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user