jopohl / urh

Universal Radio Hacker: Investigate Wireless Protocols Like A Boss
GNU General Public License v3.0
10.99k stars 874 forks source link

'Remove Carrier' encoding truncates initial input #997

Closed delta512 closed 2 years ago

delta512 commented 2 years ago

Hi, I had an issue while trying to fuzz a remote control switch, despite successful decoding.

The issue

Basically, the raw signal gets perfectly decoded by a 'Remove Carrier' function with a 0_0_0_0_0_0_0_0_0_0_0_0_0 pattern. (12 data symbols interleaved with 0s)

However, the inverse function truncates the very first 0_ pair, whatever the value of the input data. This happens if the very first character does not represent input data, as the code does not enter the if statement. This makes the for loop skip the first input sequence altogether.

The proposed fix

I managed to solve this problem by inverting the two actions within the for loop (i.e. consume the carrier first). Once all the input is consumed, the remaining carrier pattern is appended until it wraps around.

I hope you'll find this useful too!

Commit 8fbab14

Addresses truncation by consuming any leading carrier symbol before the for loop.

Commit 523a1d9

Addresses an issue with 8fbab14 where extra carrier symbols get included, due to the pattern wrapping around after all input data has been consumed.

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.