aboutsummaryrefslogtreecommitdiff
path: root/audio/audio.c
diff options
context:
space:
mode:
authorVolker RĂ¼melin <vr_qemu@t-online.de>2019-12-19 21:34:05 +0100
committerGerd Hoffmann <kraxel@redhat.com>2020-01-06 08:47:16 +0100
commit40ad46d3cc463fab5a23db466f77e37aff23f927 (patch)
tree570b69d511a35fd247337824b073386290aaaed0 /audio/audio.c
parent7c9eb86e679b3b6992f97bd60440dbd1a9a75929 (diff)
audio: fix integer overflow
Tell the compiler to do a 32bit * 32bit -> 64bit multiplication because period_ticks is a 64bit variable. The overflow occurs for audio timer periods larger than 4294967us. Fixes: be1092afa0 "audio: fix audio timer rate conversion bug" Signed-off-by: Volker RĂ¼melin <vr_qemu@t-online.de> Message-id: 8893a235-66a8-8fbe-7d95-862e29da90b1@t-online.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio/audio.c')
-rw-r--r--audio/audio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/audio/audio.c b/audio/audio.c
index 56fae55047..abea027fdf 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1738,7 +1738,7 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
if (dev->timer_period <= 0) {
s->period_ticks = 1;
} else {
- s->period_ticks = dev->timer_period * SCALE_US;
+ s->period_ticks = dev->timer_period * (int64_t)SCALE_US;
}
e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s);