ref: c33d5bbfd537c21541422ee544c5331c0fa5f654
parent: c4f768c0d02b6eb18693104fed21b01a963afc63
author: Gregory Maxwell <greg@xiph.org>
date: Sun Oct 21 14:51:37 EDT 2012
Reject inputs where there is more than one packet on the initial two pages. This will help encoder/streamer implementations that have it wrong detect their mistake a little earlier.
--- a/src/opusdec.c
+++ b/src/opusdec.c
@@ -887,6 +887,16 @@
if (!st)
quit(1);
+ if(ogg_stream_packetout(&os, &op)!=0)
+ {
+ /*The format specifies that the initial header and tags packets are on their
+ own pages. To aid implementors in discovering that their files are wrong
+ we reject them explicitly here. In some player designs files like this would
+ fail even without an explicit test.*/
+ fprintf(stderr, "Extra packets on initial header page. Invalid stream.\n");
+ quit(1);
+ }
+
/*Remember how many samples at the front we were told to skip
so that we can adjust the timestamp counting.*/
gran_offset=preskip;
@@ -917,6 +927,11 @@
{
if (!quiet)
print_comments((char*)op.packet, op.bytes);
+ if(ogg_stream_packetout(&os, &op)!=0)
+ {
+ fprintf(stderr, "Extra packets on initial tags page. Invalid stream.\n");
+ quit(1);
+ }
} else {
int ret;
opus_int64 maxout;