Browse code

oggparsevorbis: Add some sanity checks to header packet ordering/presence.

Originally committed as revision 24740 to svn://svn.ffmpeg.org/ffmpeg/trunk

Alex Converse authored on 2010/08/08 06:30:34
Showing 1 changed files
... ...
@@ -206,6 +206,12 @@ vorbis_header (AVFormatContext * s, int idx)
206 206
         return -1;
207 207
 
208 208
     priv = os->private;
209
+
210
+    if (priv->packet[pkt_type>>1])
211
+        return -1;
212
+    if (pkt_type > 1 && !priv->packet[0] || pkt_type > 3 && !priv->packet[1])
213
+        return -1;
214
+
209 215
     priv->len[pkt_type >> 1] = os->psize;
210 216
     priv->packet[pkt_type >> 1] = av_mallocz(os->psize);
211 217
     memcpy(priv->packet[pkt_type >> 1], os->buf + os->pstart, os->psize);