output/csv: fix segfault with logic channels
'i' was iterating in steps of unitsize. However, the destination array was also indexed with it, but it is of u8 type. Let 'i' run bytewise and only multiply with unitsize when we need it. This fixes parts of bug #844. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
6a235225b3
commit
d3cc09a612
|
@ -378,8 +378,8 @@ static void process_logic(struct context *ctx,
|
||||||
|
|
||||||
for (j = ch = 0; ch < ctx->num_logic_channels; j++) {
|
for (j = ch = 0; ch < ctx->num_logic_channels; j++) {
|
||||||
if (ctx->channels[j].ch->type == SR_CHANNEL_LOGIC) {
|
if (ctx->channels[j].ch->type == SR_CHANNEL_LOGIC) {
|
||||||
for (i = 0; i <= logic->length - logic->unitsize; i += logic->unitsize) {
|
for (i = 0; i < num_samples; i++) {
|
||||||
sample = logic->data + i;
|
sample = logic->data + i * logic->unitsize;
|
||||||
idx = ctx->channels[ch].ch->index;
|
idx = ctx->channels[ch].ch->index;
|
||||||
if (ctx->label_do && !ctx->label_names)
|
if (ctx->label_do && !ctx->label_names)
|
||||||
ctx->channels[j].label = "logic";
|
ctx->channels[j].label = "logic";
|
||||||
|
|
Loading…
Reference in New Issue