Menu

#304 mp4box ac3 import unterminated loop on partial last sample

v1.0 (example)
open
nobody
None
5
2014-03-10
2014-03-09
RyanS
No

mp4box never finishes importing ac3 file for a certain ac3 file.

In media_import.c gf_import_ac3() the while loop runs forever on certain ac3 files. This happens because the bitstream length - position is less than sample->dataLength, so gf_bs_read_data() does not read anything from the stream so it does not advance the position, yet there are > 6 bytes left in the bitstream, so the loop never terminates. Apparently my ac3 ends with a partial sample, and the code does not handle that case. If the stream position is not advancing then the loop never terminates.

I just created this ac3 file with dgindex. In any case mp4box should probably not hang forever on a bad ac3.

I think the fix is something like break out of the while loop if remaining bytes in bitstream is less than samp->dataLength. Maybe based on return value of 0 from gf_bs_read_data() but there is another case in there that returns 0 so not sure.

Related

Bugs: #304

Discussion

  • Romain Bouqueau

    Romain Bouqueau - 2014-03-10

    Hi, thanks for reporting.

    Would it be possible to share a sample file with us? You can use wetransfer.com for example (stays alive for one week). And send it via PM if you don't want the URL do be public.

    Thanks,

    Romain

     
    • RyanS

      RyanS - 2014-03-11

      Hi Romain,

      I used WeTransfer to share the file with you. Please let me know if you
      have any trouble with it.

      Ryan

      On Mon, Mar 10, 2014 at 12:59 AM, Romain Bouqueau rbouqueau@users.sf.netwrote:

      Hi, thanks for reporting.

      Would it be possible to share a sample file with us? You can use
      wetransfer.com for example (stays alive for one week). And send it via PM
      if you don't want the URL do be public.

      Thanks,

      Romain

      Status: open
      Group: v1.0 (example)
      Created: Sun Mar 09, 2014 10:21 PM UTC by RyanS
      Last Updated: Sun Mar 09, 2014 10:21 PM UTC
      Owner: nobody

      mp4box never finishes importing ac3 file for a certain ac3 file.

      In media_import.c gf_import_ac3() the while loop runs forever on certain
      ac3 files. This happens because the bitstream length - position is less
      than sample->dataLength, so gf_bs_read_data() does not read anything from
      the stream so it does not advance the position, yet there are > 6 bytes
      left in the bitstream, so the loop never terminates. Apparently my ac3 ends
      with a partial sample, and the code does not handle that case. If the
      stream position is not advancing then the loop never terminates.

      I just created this ac3 file with dgindex. In any case mp4box should
      probably not hang forever on a bad ac3.

      I think the fix is something like break out of the while loop if remaining
      bytes in bitstream is less than samp->dataLength. Maybe based on return
      value of 0 from gf_bs_read_data() but there is another case in there that
      returns 0 so not sure.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/gpac/bugs/304/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #304


Log in to post a comment.

MongoDB Logo MongoDB