From 59a4e58c98afbdecd5597816f43d9cd8d00c7802 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 5 Jun 2024 04:09:56 -0700 Subject: [PATCH] Fix blob % 4 bug Seems to work as intended now. It fixes the issue and the only other user of pad_to_32_bit_boundary is read_osc_string and that seems unaffected. --- src/decoder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decoder.rs b/src/decoder.rs index 1d9c579..4b39a50 100644 --- a/src/decoder.rs +++ b/src/decoder.rs @@ -282,7 +282,7 @@ fn pad_to_32_bit_boundary<'a>( original_input: &'a [u8], ) -> impl Fn(&'a [u8]) -> IResult<&'a [u8], (), OscError> { move |input| { - let offset = 4 - original_input.offset(input) % 4; + let offset = (4 - original_input.offset(input) % 4) % 4; let (input, _) = take(offset)(input)?; Ok((input, ())) }