Skip to content

Commit

Permalink
Add core decoder excessive frame size workaround.
Browse files Browse the repository at this point in the history
Certain DTS in WAV streams have core frame size stored in header one
byte larger than actual distance between sync words. Because of this
overread check based on frame size always fails. Work this around by
checking overread against the size of provided data in case frame size
is larger.

Internal stream parser is yet to be fixed to make such files work.
  • Loading branch information
foo86 committed May 25, 2015
1 parent 092cee6 commit 57012ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libdcadec/core_decoder.c
Expand Up @@ -2031,6 +2031,7 @@ int core_parse(struct core_decoder *core, uint8_t *data, size_t size,
bits_init(&core->bits, data + asset->core_offset, asset->core_size);
if (bits_get(&core->bits, 32) != SYNC_WORD_CORE_EXSS)
return -DCADEC_ENOSYNC;
size = asset->core_size;
} else {
bits_init(&core->bits, data, size);
bits_skip(&core->bits, 32);
Expand All @@ -2045,6 +2046,8 @@ int core_parse(struct core_decoder *core, uint8_t *data, size_t size,
return ret;
if ((ret = parse_optional_info(core, flags)) < 0)
return ret;
if (core->frame_size > size)
core->frame_size = size;
if ((ret = bits_seek(&core->bits, core->frame_size * 8)) < 0)
return ret;
return 0;
Expand Down

0 comments on commit 57012ea

Please sign in to comment.