mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Avoid segfault generating DataBar Stacked
Do not read element values which have not been initialised when stacking symbol Fixes #6
This commit is contained in:
parent
bfb3964fc0
commit
27c7c9447c
@ -2121,8 +2121,10 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
left_to_right = 1;
|
||||
i = 2 + (current_block * 21);
|
||||
for(j = 0; j < 21; j++) {
|
||||
sub_elements[j + (reader * 21) + 2] = elements[i + j];
|
||||
elements_in_sub++;
|
||||
if((i + j) < pattern_width) {
|
||||
sub_elements[j + (reader * 21) + 2] = elements[i + j];
|
||||
elements_in_sub++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* right to left */
|
||||
@ -2131,8 +2133,10 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
/* a full row */
|
||||
i = 2 + (((current_row * symbol->option_2) - reader - 1) * 21);
|
||||
for(j = 0; j < 21; j++) {
|
||||
sub_elements[(20 - j) + (reader * 21) + 2] = elements[i + j];
|
||||
elements_in_sub++;
|
||||
if((i + j) < pattern_width) {
|
||||
sub_elements[(20 - j) + (reader * 21) + 2] = elements[i + j];
|
||||
elements_in_sub++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* a partial row */
|
||||
@ -2140,8 +2144,10 @@ int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
||||
l = (current_row * symbol->option_2) - reader - 1;
|
||||
i = 2 + ((l - k) * 21);
|
||||
for(j = 0; j < 21; j++) {
|
||||
sub_elements[(20 - j) + (reader * 21) + 2] = elements[i + j];
|
||||
elements_in_sub++;
|
||||
if((i + j) < pattern_width) {
|
||||
sub_elements[(20 - j) + (reader * 21) + 2] = elements[i + j];
|
||||
elements_in_sub++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user