From 3284e6c09a84e9557ec72723ad636053d3ef7122 Mon Sep 17 00:00:00 2001 From: Tim Akinbo <41004+takinbo@users.noreply.github.com> Date: Wed, 4 Sep 2019 07:07:14 +0000 Subject: [PATCH] scripts: search for next position of magic bytes rather than fail document seek method for next position of magic bytes --- contrib/linearize/linearize-data.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/linearize/linearize-data.py b/contrib/linearize/linearize-data.py index 468aec04b..e0718f107 100755 --- a/contrib/linearize/linearize-data.py +++ b/contrib/linearize/linearize-data.py @@ -213,8 +213,11 @@ class BlockDataCopier: inMagic = inhdr[:4] if (inMagic != self.settings['netmagic']): - print("Invalid magic: " + inMagic.hex()) - return + # Seek backwards 7 bytes (skipping the first byte in the previous search) + # and continue searching from the new position if the magic bytes are not + # found. + self.inF.seek(-7, os.SEEK_CUR) + continue inLenLE = inhdr[4:] su = struct.unpack("