summaryrefslogtreecommitdiffstats
path: root/mkbootimg
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2016-03-29 16:06:37 -0700
committerSami Tolvanen <samitolvanen@google.com>2016-03-29 16:06:37 -0700
commit294eb9dac3c06a37bc1c9547fa8a26bcf4cdc749 (patch)
tree6ad76631ad6e71f645349ba5fba9899a34f4e9f4 /mkbootimg
parentfbdbf100cb48f18d308c96f1959945cf7d1909ec (diff)
downloadsystem_core-294eb9dac3c06a37bc1c9547fa8a26bcf4cdc749.tar.gz
system_core-294eb9dac3c06a37bc1c9547fa8a26bcf4cdc749.tar.bz2
system_core-294eb9dac3c06a37bc1c9547fa8a26bcf4cdc749.zip
mkbootimg: use int for os_version and os_patch_level
The parse_int function attempts to interpret the string to detect base, which leads to it assuming strings starting with 0 are base 8. This obviously fails for certain dates, so use int instead. Bug: 27498078 Bug: 22914603 Change-Id: I50b1fb3d7876f2ec17d00649cc9a2d23af2aec2b
Diffstat (limited to 'mkbootimg')
-rwxr-xr-xmkbootimg/mkbootimg10
1 files changed, 5 insertions, 5 deletions
diff --git a/mkbootimg/mkbootimg b/mkbootimg/mkbootimg
index 7b04bcc7b..5a13da26b 100755
--- a/mkbootimg/mkbootimg
+++ b/mkbootimg/mkbootimg
@@ -102,12 +102,12 @@ def parse_int(x):
def parse_os_version(x):
match = re.search(r'^(\d{1,3})(?:\.(\d{1,3})(?:\.(\d{1,3}))?)?', x)
if match:
- a = parse_int(match.group(1))
+ a = int(match.group(1))
b = c = 0
if match.lastindex >= 2:
- b = parse_int(match.group(2))
+ b = int(match.group(2))
if match.lastindex == 3:
- c = parse_int(match.group(3))
+ c = int(match.group(3))
# 7 bits allocated for each field
assert a < 128
assert b < 128
@@ -118,8 +118,8 @@ def parse_os_version(x):
def parse_os_patch_level(x):
match = re.search(r'^(\d{4})-(\d{2})-(\d{2})', x)
if match:
- y = parse_int(match.group(1)) - 2000
- m = parse_int(match.group(2))
+ y = int(match.group(1)) - 2000
+ m = int(match.group(2))
# 7 bits allocated for the year, 4 bits for the month
assert y >= 0 and y < 128
assert m > 0 and m <= 12