qemu-cr16/replay
Peter Maydell 78d66a25c5 replay: Improve assert in replay_char_read_all_load()
In replay_char_read_all_load() we get a buffer and size from the
replay log.  We know the size has to fit an int because of how we
write the log.  However the way we assert this is wrong: we cast the
size_t from replay_get_array() to an int and then check that it is
non-negative.  This misses cases where an over-large size is
truncated into a positive value by the cast.

Replace the assertion with checking that the size is in-range
before doing the cast.

Coverity complained about the possible overflow: CID 1643440.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251124173407.50124-1-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2025-11-25 22:45:30 +01:00
..
meson.build meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
replay-audio.c audio: move audio.h under include/qemu/ 2025-10-30 22:56:51 +04:00
replay-char.c replay: Improve assert in replay_char_read_all_load() 2025-11-25 22:45:30 +01:00
replay-debugging.c qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
replay-events.c cpus: properly kick CPUs out of inner execution loop 2025-09-17 19:00:55 +02:00
replay-input.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
replay-internal.c replay: add tracing events 2025-11-19 09:24:01 +01:00
replay-internal.h replay: introduce a central report point for sync errors 2024-01-08 13:58:54 +00:00
replay-net.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
replay-random.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
replay-snapshot.c qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
replay-time.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
replay.c record/replay: fix race condition on test_aarch64_reverse_debug 2025-10-07 09:15:45 +01:00
stubs-system.c audio/replay: fix type punning 2025-10-30 22:56:28 +04:00
trace-events replay: add tracing events 2025-11-19 09:24:01 +01:00
trace.h replay: add tracing events 2025-11-19 09:24:01 +01:00