forked from Imagelibrary/littlefs
scripts: Added -w/--word-bits to bound dbgleb128/dbgle32 parsing
This is limited to dbgle32.py, dbgleb128.py, and dbgtag.py for now. This more closely matches how littlefs behaves, in that we read a bounded number of bytes before leb128 decoding. This minimizes bugs related to leb128 overflow and avoids reading inherently undecodable data. The previous unbounded behavior is still available with -w0. Note this gives dbgle32.py much more flexibility in that it can now decode other integer widths. Uh, ignore the name for now. At least it's self documenting that the default is 32-bits... --- Also fixed a bug in fromleb128 where size was reported incorrectly on offset + truncated leb128.
This commit is contained in:
@@ -213,7 +213,7 @@ def fromleb128(data, j=0):
|
||||
if not b & 0x80:
|
||||
return word, d+1
|
||||
d += 1
|
||||
return word, len(data)
|
||||
return word, d
|
||||
|
||||
def fromtag(data, j=0):
|
||||
d = 0
|
||||
|
||||
Reference in New Issue
Block a user