python: raise CsError(CS_ERR_SKIPDATA) when accessing irrelevant data in skipdata mode. this fixes issue #679

This commit is contained in:
Nguyen Anh Quynh 2018-07-18 13:37:45 +08:00
parent 90963c0cb1
commit a1ccc8ebda
1 changed files with 6 additions and 0 deletions

View File

@ -541,6 +541,10 @@ class CsInsn(object):
raise CsError(CS_ERR_DETAIL)
def __gen_detail(self):
if self._raw.id == 0:
# do nothing in skipdata mode
return
arch = self._cs.arch
if arch == CS_ARCH_ARM:
(self.usermode, self.vector_size, self.vector_data, self.cps_mode, self.cps_flag, self.cc, self.update_flags, \
@ -577,6 +581,8 @@ class CsInsn(object):
if 'operands' not in _dict:
self.__gen_detail()
if name not in _dict:
if self._raw.id == 0:
raise CsError(CS_ERR_SKIPDATA)
raise AttributeError(name)
return _dict[name]