diff options
| author | Tom McDermott <spon@wattwatchers.com.au> | 2019-08-05 15:15:28 +1000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2019-09-02 13:10:55 +1000 |
| commit | 1022f9cc35564b216a4bcd7c65e8243c810a0ca9 (patch) | |
| tree | bc2d7d12d447a63f6a4c1c9e0f862a616a9b9a80 /extmod | |
| parent | 12f13ee6346d8fd029fc2ecec06d50b5f7f6b252 (diff) | |
py/modstruct: Fix struct.unpack with unaligned offset of native type.
With this patch alignment is done relative to the start of the buffer that
is being unpacked, not the raw pointer value, as per CPython.
Fixes issue #3314.
Diffstat (limited to 'extmod')
| -rw-r--r-- | extmod/moductypes.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/moductypes.c b/extmod/moductypes.c index 9b46371f3..d4c7611df 100644 --- a/extmod/moductypes.c +++ b/extmod/moductypes.c @@ -299,7 +299,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(uctypes_struct_sizeof_obj, 1, 2, ucty static inline mp_obj_t get_unaligned(uint val_type, byte *p, int big_endian) { char struct_type = big_endian ? '>' : '<'; static const char type2char[16] = "BbHhIiQq------fd"; - return mp_binary_get_val(struct_type, type2char[val_type], &p); + return mp_binary_get_val(struct_type, type2char[val_type], p, &p); } static inline void set_unaligned(uint val_type, byte *p, int big_endian, mp_obj_t val) { |
