Menu

#305 Sox blocking in an infinite loop when decoding AMR files

closed-fixed
amr (1) crash (4)
5
2018-05-25
2018-02-08
Andrea
No

To reproduce the bug:

printf '#!AMR\n\x60' > /tmp/a.amr
sox /tmp/a.amr /tmp/a.wav

The issue is in amr_duration_frames() of src/amr.h. The array amr_block_size has some zero entries. When 'coded' is such that amr_block_size[coded >> 3 & 15] is equal to 0, the variable frame_size becomes zero, and lsx_seeki() performs an invalid seek: the seek is negative and it goes backward of one byte, entering in a loop.

Another point is in decode_1_frame() of src/amr.h. As above, the entry amr_block_size[coded...] can be zero. In this case, n_1 becomes equal to -1. Being n_1 unsigned (size_t), n_1 becomes invalid.

I do not know if there are other critical points.

Discussion

  • Mans Rullgard

    Mans Rullgard - 2018-04-26
    • labels: --> amr, crash
    • status: open --> pending-fixed
    • assigned_to: Mans Rullgard
     
  • Mans Rullgard

    Mans Rullgard - 2018-04-29
    • status: pending-fixed --> closed-fixed
     
  • Andrea

    Andrea - 2018-05-25

    It is fixed. Thanks.
    Please note that sox fails but its exit code is 0.

     

Log in to post a comment.