Skip to content

Commit 1387e7c

Browse files
dcpleungnashif
authored andcommitted
scripts: coredump: fix crashing on non-existent memory region
get_mem_region() may return None for a non-existent memory region so we need to check first before looking at its properties. Signed-off-by: Daniel Leung <[email protected]>
1 parent e932a15 commit 1387e7c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/coredump/gdbstubs/gdbstub.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,14 @@ def get_mem_region(addr):
139139
barray = b''
140140
r = get_mem_region(addr)
141141
while remaining > 0:
142-
if addr > r['end']:
143-
r = get_mem_region(addr)
144-
145142
if r is None:
146143
barray = None
147144
break
148145

146+
if addr > r['end']:
147+
r = get_mem_region(addr)
148+
continue
149+
149150
offset = addr - r['start']
150151
barray += r['data'][offset:offset+1]
151152

0 commit comments

Comments
 (0)