Skip to content

Commit

Permalink
Add excessive frame size workaround to stream parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
foo86 committed May 28, 2015
1 parent 57012ea commit bb04be2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libdcadec/dca_stream.c
Expand Up @@ -280,6 +280,10 @@ static int read_frame(struct dcadec_stream *stream, uint32_t *sync_p)
if (fread(buf + sizeof(header), frame_size - sizeof(header), 1, stream->fp) != 1)
return 0;

// Work around overread that occurs for 14-bit streams with excessive frame size
if (sync == SYNC_WORD_CORE_LE14 || sync == SYNC_WORD_CORE_BE14)
stream->backup_sync = DCA_MEM32BE(&buf[frame_size - 4]);

// Convert the frame in place
if ((ret = dcadec_frame_convert_bitstream(buf, &frame_size, buf, frame_size)) < 0)
return ret;
Expand Down

0 comments on commit bb04be2

Please sign in to comment.