Skip to content

Commit f26a7bb

Browse files
committed
fix: Add timeout to read_flash to avoid infinite loops
This should handle cases when e.g. reading more then flash size
1 parent 851919f commit f26a7bb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

esptool/loader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,7 @@ def read_flash(self, offset, length, progress_fn=None) -> bytes:
13591359
# now we expect (length // block_size) SLIP frames with the data
13601360
data = b""
13611361
while len(data) < length:
1362+
self._port.timeout = 3
13621363
p = self.read()
13631364
data += p
13641365
data_len = len(data)

0 commit comments

Comments
 (0)