reject continued header pages

This commit is contained in:
Frédéric Mangano-Tarumi 2018-12-05 20:11:03 -05:00
parent c01045172c
commit 4e3ee61ca3
2 changed files with 5 additions and 3 deletions

View File

@ -35,6 +35,8 @@ ot::status ot::ogg_reader::read_page()
ot::status ot::ogg_reader::read_header_packet(const std::function<status(ogg_packet&)>& f)
{
if (ogg_page_continued(&page))
return {ot::st::error, "Unexpected continued header page."};
ogg_stream stream(ogg_page_serialno(&page));
stream.pageno = ogg_page_pageno(&page);
if (ogg_stream_pagein(&stream, &page) != 0)

View File

@ -175,9 +175,9 @@ struct ogg_reader {
*/
status read_page();
/**
* Read the single packet contained in a header page, and call the function f on it. This
* function has no side effect, and calling it twice on the same page will read the same
* packet again.
* Read the single packet contained in the last page read, assuming it's a header page, and
* call the function f on it. This function has no side effect, and calling it twice on the
* same page will read the same packet again.
*
* It is currently limited to packets that fit on a single page, and should be later
* extended to support packets spanning multiple pages.