Merge pull request #366 from uweigand/nautilus-endianfix

[ceph-nautilus] Fix fuzzer test on big-endian systems
This commit is contained in:
Ali Maredia 2020-11-23 19:07:06 -05:00 committed by GitHub
commit 3c76774ad9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -189,7 +189,7 @@ class RepeatExpandingFormatter(string.Formatter):
if charset_arg == 'binary' or charset_arg == 'binary_no_whitespace': if charset_arg == 'binary' or charset_arg == 'binary_no_whitespace':
num_bytes = length + 8 num_bytes = length + 8
tmplist = [self.prng.getrandbits(64) for _ in xrange(num_bytes / 8)] tmplist = [self.prng.getrandbits(64) for _ in xrange(num_bytes / 8)]
tmpstring = struct.pack((num_bytes / 8) * 'Q', *tmplist) tmpstring = struct.pack('<' + (num_bytes / 8) * 'Q', *tmplist)
if charset_arg == 'binary_no_whitespace': if charset_arg == 'binary_no_whitespace':
tmpstring = ''.join(c for c in tmpstring if c not in string.whitespace) tmpstring = ''.join(c for c in tmpstring if c not in string.whitespace)
return tmpstring[0:length] return tmpstring[0:length]