Fix unaligned load of 4 bytes for typeid
Use memcpy() to move the typeid to an aligned address.
This commit is contained in:
parent
61d57901b1
commit
d98ca97624
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
||||
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||
|
||||
#include "nanos6_priv.h"
|
||||
@ -521,7 +521,8 @@ pre_type(struct emu *emu)
|
||||
}
|
||||
|
||||
const uint8_t *data = &emu->ev->payload->jumbo.data[0];
|
||||
uint32_t typeid = *(uint32_t *) data;
|
||||
uint32_t typeid;
|
||||
memcpy(&typeid, data, 4); /* May be unaligned */
|
||||
data += 4;
|
||||
|
||||
const char *label = (const char *) data;
|
||||
|
@ -546,7 +546,8 @@ pre_type(struct emu *emu)
|
||||
}
|
||||
|
||||
const uint8_t *data = &emu->ev->payload->jumbo.data[0];
|
||||
uint32_t typeid = *(uint32_t *) data;
|
||||
uint32_t typeid;
|
||||
memcpy(&typeid, data, 4); /* May be unaligned */
|
||||
data += 4;
|
||||
|
||||
const char *label = (const char *) data;
|
||||
|
Loading…
Reference in New Issue
Block a user