src/encode.c : Fix potential infinite loop in flac-toflac encoding.
authorErik de Castro Lopo <erikd@mega-nerd.com>
Sun, 22 Feb 2015 07:05:12 +0000 (18:05 +1100)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Sun, 22 Feb 2015 10:44:27 +0000 (21:44 +1100)
commit8267168d283ae9bc213617b97afc6878f1cdfb8a
treed742fbb80677ef661fe242994adf18b329bfa291
parentffcda161ad1f47d730490c91bb95653c4a0be403
src/encode.c : Fix potential infinite loop in flac-toflac encoding.

A malformed file (generated by AFL) had a 'samples_left_to_process' value
of greater than the actual numbe of samples. When re-encoding the decoder
would get to the end of the file and then continuously return a decode
status of FLAC__STREAM_DECODER_END_OF_STREAM, causing an infinite loop.

Solution is to break out of the loop on two consecutive end-of-stream
events.
src/flac/encode.c