From cb0fedd942ce286eb77de4dd1e3f981566f6ab6d Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Thu, 23 Jul 2020 21:55:30 +0200 Subject: [PATCH] input/binary: align sr_session_send() chunks to unit size The input/binary module chops raw input data into chunks and sends these to the session feed. The total size of input chunks got aligned to the unit size, the session feed output didn't. Make sure to align session packets with the input data's unit size, too. This fixes bug #1582. --- src/input/binary.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/input/binary.c b/src/input/binary.c index da664a85..51a64d09 100644 --- a/src/input/binary.c +++ b/src/input/binary.c @@ -103,6 +103,8 @@ static int process_buffer(struct sr_input *in) for (i = 0; i < chunk_size; i += chunk) { logic.data = in->buf->str + i; chunk = MIN(CHUNK_SIZE, chunk_size - i); + chunk /= logic.unitsize; + chunk *= logic.unitsize; logic.length = chunk; sr_session_send(in->sdi, &packet); }