Quantcast
Channel: Intel® Software - Intel® Integrated Performance Primitives
Viewing all articles
Browse latest Browse all 1489

Infinite loop while MP3 encoding : mp3enc_bitsrteam.c

$
0
0

In the current implementation of mp3enc_writeFrame() inside the file mp3enc_bitstream.c, it is possible that we can encounter infinite loop while executing the code block below.

Whenever the code below gets called with resr_mod_slot = 1, we end up with an infinite loop.

Any suggestions on how to fix this ?

 do {

          Ipp32s left = resr_mod_slot;

          len = left < bytes ? left : bytes;

          for (i = 0; i < len; i++)

              *ptr_out++ = *ptr_main++;

          res += len;

          bytes -= len;

          resr_bytes -= len;

          resr_mod_slot -= len;

          if (resr_mod_slot < 0)

              resr_mod_slot += slot;

          if (len == left && si_num > 0) {

              for (i = 0; i < si_bytes; i++)

                  *ptr_out++ =

                      si_buf[si_beg][i];

              res += si_bytes;

              resr_bytes -= si_bytes;

              resr_mod_slot -= si_bytes;

              if (resr_mod_slot < 0)

                  resr_mod_slot += slot;

              si_num--;

              si_beg++;

              if (si_beg >= SI_MAX)

                  si_beg = 0;

          }

      } while(bytes)


Viewing all articles
Browse latest Browse all 1489

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>