Skip to content

Commit 0352a41

Browse files
mahalozltfish
authored andcommittedFeb 7, 2024
Add a max search param (kill the loop)
1 parent a8929e9 commit 0352a41

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎cle/backends/ihex.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,12 @@ def __init__(self, *args, ignore_missing_arch: bool = False, **kwargs):
164164
self._min_addr = min_addr
165165

166166
@staticmethod
167-
def seek_non_space_bytes(stream: "BytesIO", length=0x10):
167+
def seek_non_space_bytes(stream: "BytesIO", length=0x10, max_search=0x50):
168168
data = b""
169169
stream.seek(0)
170-
while len(data) < length and stream:
170+
search_len = 0
171+
while search_len < max_search and len(data) < length and stream:
172+
search_len += 1
171173
byte = stream.read(1)
172174
if not byte:
173175
# we have exhausted the stream

0 commit comments

Comments
 (0)