mirror of https://github.com/xemu-project/xemu.git
migration/qemu-file.c: Don't shift left into sign bit
Add a cast in qemu_get_be32() to avoid shifting left into the sign bit of a signed integer (which is undefined behaviour in C). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
2d8ac5eb7a
commit
90d6a6730b
|
@ -503,7 +503,7 @@ unsigned int qemu_get_be16(QEMUFile *f)
|
|||
unsigned int qemu_get_be32(QEMUFile *f)
|
||||
{
|
||||
unsigned int v;
|
||||
v = qemu_get_byte(f) << 24;
|
||||
v = (unsigned int)qemu_get_byte(f) << 24;
|
||||
v |= qemu_get_byte(f) << 16;
|
||||
v |= qemu_get_byte(f) << 8;
|
||||
v |= qemu_get_byte(f);
|
||||
|
|
Loading…
Reference in New Issue