qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

audio: st_rate_flow exist a infinite loop

If a voice recording equipment is opened for a long time(several days)
in windows guest, rate->ipos will overflow and rate->opos will never
have a chance to change. It will result to a infinite loop.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Message-id: 1500128061-20849-1-git-send-email-peng.hao2@zte.com.cn
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

authored by

Peng Hao and committed by
Gerd Hoffmann
facd0e97 6e2c4633

+6
+6
audio/rate_template.h
··· 71 71 while (rate->ipos <= (rate->opos >> 32)) { 72 72 ilast = *ibuf++; 73 73 rate->ipos++; 74 + 75 + /* if ipos overflow, there is a infinite loop */ 76 + if (rate->ipos == 0xffffffff) { 77 + rate->ipos = 1; 78 + rate->opos = rate->opos & 0xffffffff; 79 + } 74 80 /* See if we finished the input buffer yet */ 75 81 if (ibuf >= iend) { 76 82 goto the_end;