mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-21 14:48:14 +00:00
oggdemux: Protect against invalid granule positions
Only valid values are -1, 0 or positive values. Anything else is most likely corrupted data streams
This commit is contained in:
parent
c493c564ba
commit
1172e5efc7
1 changed files with 10 additions and 1 deletions
|
@ -662,7 +662,7 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet,
|
||||||
out_offset = 0;
|
out_offset = 0;
|
||||||
out_offset_end = -1;
|
out_offset_end = -1;
|
||||||
} else {
|
} else {
|
||||||
if (packet->granulepos != -1) {
|
if (packet->granulepos > -1) {
|
||||||
gint64 granule = gst_ogg_stream_granulepos_to_granule (&pad->map,
|
gint64 granule = gst_ogg_stream_granulepos_to_granule (&pad->map,
|
||||||
packet->granulepos);
|
packet->granulepos);
|
||||||
if (granule < 0) {
|
if (granule < 0) {
|
||||||
|
@ -1284,6 +1284,15 @@ gst_ogg_pad_stream_out (GstOggPad * pad, gint npackets)
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
GST_LOG_OBJECT (ogg, "packetout gave packet of size %ld", packet.bytes);
|
GST_LOG_OBJECT (ogg, "packetout gave packet of size %ld", packet.bytes);
|
||||||
|
|
||||||
|
if (packet.granulepos < -1) {
|
||||||
|
GST_WARNING_OBJECT (ogg,
|
||||||
|
"Invalid granulepos (%" G_GINT64_FORMAT "), resetting stream",
|
||||||
|
packet.granulepos);
|
||||||
|
gst_ogg_pad_reset (pad);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (packet.bytes > ogg->max_packet_size)
|
if (packet.bytes > ogg->max_packet_size)
|
||||||
ogg->max_packet_size = packet.bytes;
|
ogg->max_packet_size = packet.bytes;
|
||||||
result = gst_ogg_pad_submit_packet (pad, &packet);
|
result = gst_ogg_pad_submit_packet (pad, &packet);
|
||||||
|
|
Loading…
Reference in a new issue