diff options
| author | Aymeric Vincent <aymeric.vincent@cea.fr> | 2016-04-05 12:41:16 +0200 |
|---|---|---|
| committer | Aymeric Vincent <aymeric.vincent@cea.fr> | 2016-04-05 12:42:37 +0200 |
| commit | f4220a38bc8724a58e554947002cec7b68ef16cd (patch) | |
| tree | 1ea7a2dfb33118fd6d9703a32ecd8e55ea868603 /miasm2/core | |
| parent | 4eceb2b2e723409b610533788c0b98ec23a9e204 (diff) | |
| download | miasm-f4220a38bc8724a58e554947002cec7b68ef16cd.tar.gz miasm-f4220a38bc8724a58e554947002cec7b68ef16cd.zip | |
fix bin_stream.getbits()
Diffstat (limited to 'miasm2/core')
| -rw-r--r-- | miasm2/core/bin_stream.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/miasm2/core/bin_stream.py b/miasm2/core/bin_stream.py index cfcdf8a5..67a67de8 100644 --- a/miasm2/core/bin_stream.py +++ b/miasm2/core/bin_stream.py @@ -15,7 +15,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -import math class bin_stream(object): @@ -78,7 +77,9 @@ class bin_stream(object): # Get initial bytes if n > self.getlen() * 8: raise IOError('not enough bits %r %r' % (n, len(self.bin) * 8)) - temp = self.getbytes(start / 8, int(math.ceil(n / 8.))) + byte_start = start / 8 + byte_stop = (start + n + 7) / 8 + temp = self.getbytes(byte_start, byte_stop - byte_start) if not temp: raise IOError('cannot get bytes') |