From 4e3ee61ca30748c3d5601b9accb54f1c543322aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mangano-Tarumi?= Date: Wed, 5 Dec 2018 20:11:03 -0500 Subject: [PATCH] reject continued header pages --- src/ogg.cc | 2 ++ src/opustags.h | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ogg.cc b/src/ogg.cc index 25f24ed..d144f92 100644 --- a/src/ogg.cc +++ b/src/ogg.cc @@ -35,6 +35,8 @@ ot::status ot::ogg_reader::read_page() ot::status ot::ogg_reader::read_header_packet(const std::function& 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) diff --git a/src/opustags.h b/src/opustags.h index 05508e8..e66c3e5 100644 --- a/src/opustags.h +++ b/src/opustags.h @@ -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.