Commit facd0e97 authored by Peng Hao's avatar Peng Hao Committed by Gerd Hoffmann
Browse files

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: default avatarPeng Hao <peng.hao2@zte.com.cn>
Signed-off-by: default avatarWang Yechao <wang.yechao255@zte.com.cn>
Message-id: 1500128061-20849-1-git-send-email-peng.hao2@zte.com.cn
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 6e2c4633
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -71,6 +71,12 @@ void NAME (void *opaque, struct st_sample *ibuf, struct st_sample *obuf,
        while (rate->ipos <= (rate->opos >> 32)) {
            ilast = *ibuf++;
            rate->ipos++;

            /* if ipos overflow, there is  a infinite loop */
            if (rate->ipos == 0xffffffff) {
                rate->ipos = 1;
                rate->opos = rate->opos & 0xffffffff;
            }
            /* See if we finished the input buffer yet */
            if (ibuf >= iend) {
                goto the_end;