mirror of
https://github.com/androguard/androguard.git
synced 2024-11-23 13:09:55 +00:00
Merge pull request #1016 from androguard/1014
Reserved values res0/res1 error
This commit is contained in:
commit
23ad0b992d
@ -1,4 +1,4 @@
|
||||
# The current version of Androguard
|
||||
# Please use only this variable in any scripts,
|
||||
# to keep the version number the same everywhere.
|
||||
__version__ = "4.1.0"
|
||||
__version__ = "4.1.1"
|
||||
|
@ -2337,18 +2337,19 @@ class ARSCResTypeSpec:
|
||||
self.id = unpack('<B', buff.read(1))[0]
|
||||
self.res0 = unpack('<B', buff.read(1))[0]
|
||||
self.res1 = unpack('<H', buff.read(2))[0]
|
||||
# TODO: https://github.com/androguard/androguard/issues/1014 | Properly account for the cases where res0/1 are not zero
|
||||
try:
|
||||
if self.res0 != 0:
|
||||
raise ResParserError("res0 must be zero!")
|
||||
logger.warning("res0 must be zero!")
|
||||
if self.res1 != 0:
|
||||
raise ResParserError("res1 must be zero!")
|
||||
logger.warning("res1 must be zero!")
|
||||
self.entryCount = unpack('<I', buff.read(4))[0]
|
||||
|
||||
self.typespec_entries = []
|
||||
for i in range(0, self.entryCount):
|
||||
self.typespec_entries.append(unpack('<I', buff.read(4))[0])
|
||||
except ResParserError as e:
|
||||
logger.warning(e)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
class ARSCResType:
|
||||
"""
|
||||
@ -2943,12 +2944,12 @@ class ARSCResStringPoolRef:
|
||||
self.res0, = unpack("<B", buff.read(1))
|
||||
try:
|
||||
if self.res0 != 0:
|
||||
raise ResParserError("res0 must be always zero!")
|
||||
logger.warning("res0 must be always zero!")
|
||||
self.data_type = unpack('<B', buff.read(1))[0]
|
||||
# data is interpreted according to data_type
|
||||
self.data = unpack('<I', buff.read(4))[0]
|
||||
except ResParserError as e:
|
||||
logger.warning(e)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
|
||||
def get_data_value(self):
|
||||
return self.parent.stringpool_main.getString(self.data)
|
||||
|
@ -2,7 +2,7 @@
|
||||
name = "androguard"
|
||||
description = "Androguard is a full python tool to play with Android files."
|
||||
authors = ["desnos <desnos@t0t0.fr>"]
|
||||
version = "4.1.0"
|
||||
version = "4.1.1"
|
||||
license = "Apache Licence, Version 2.0"
|
||||
readme = "README.md"
|
||||
homepage = "https://github.com/androguard/androguard"
|
||||
|
Loading…
Reference in New Issue
Block a user