mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
oggstream: review and fix per-format min_packet_size
This addresses all manually detected invalid reads in setup functions. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8038>
This commit is contained in:
parent
006047a23a
commit
e633ec6428
1 changed files with 12 additions and 28 deletions
|
@ -665,11 +665,6 @@ setup_vp8_mapper (GstOggStream * pad, ogg_packet * packet)
|
||||||
{
|
{
|
||||||
gint width, height, par_n, par_d, fps_n, fps_d;
|
gint width, height, par_n, par_d, fps_n, fps_d;
|
||||||
|
|
||||||
if (packet->bytes < 26) {
|
|
||||||
GST_DEBUG ("Failed to parse VP8 BOS page");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
width = GST_READ_UINT16_BE (packet->packet + 8);
|
width = GST_READ_UINT16_BE (packet->packet + 8);
|
||||||
height = GST_READ_UINT16_BE (packet->packet + 10);
|
height = GST_READ_UINT16_BE (packet->packet + 10);
|
||||||
par_n = GST_READ_UINT24_BE (packet->packet + 12);
|
par_n = GST_READ_UINT24_BE (packet->packet + 12);
|
||||||
|
@ -1221,11 +1216,6 @@ setup_fishead_mapper (GstOggStream * pad, ogg_packet * packet)
|
||||||
gint64 prestime_n, prestime_d;
|
gint64 prestime_n, prestime_d;
|
||||||
gint64 basetime_n, basetime_d;
|
gint64 basetime_n, basetime_d;
|
||||||
|
|
||||||
if (packet->bytes < 44) {
|
|
||||||
GST_DEBUG ("Not enough data for fishead header");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
data = packet->packet;
|
data = packet->packet;
|
||||||
|
|
||||||
data += 8; /* header */
|
data += 8; /* header */
|
||||||
|
@ -1256,8 +1246,8 @@ setup_fishead_mapper (GstOggStream * pad, ogg_packet * packet)
|
||||||
pad->prestime = -1;
|
pad->prestime = -1;
|
||||||
|
|
||||||
/* Ogg Skeleton 3.3+ streams provide additional information in the header */
|
/* Ogg Skeleton 3.3+ streams provide additional information in the header */
|
||||||
if (packet->bytes >= SKELETON_FISHEAD_3_3_MIN_SIZE && pad->skeleton_major == 3
|
if (packet->bytes - 44 >= SKELETON_FISHEAD_3_3_MIN_SIZE
|
||||||
&& pad->skeleton_minor > 0) {
|
&& pad->skeleton_major == 3 && pad->skeleton_minor > 0) {
|
||||||
gint64 firstsampletime_n, firstsampletime_d;
|
gint64 firstsampletime_n, firstsampletime_d;
|
||||||
gint64 lastsampletime_n, lastsampletime_d;
|
gint64 lastsampletime_n, lastsampletime_d;
|
||||||
gint64 firstsampletime, lastsampletime;
|
gint64 firstsampletime, lastsampletime;
|
||||||
|
@ -1296,7 +1286,7 @@ setup_fishead_mapper (GstOggStream * pad, ogg_packet * packet)
|
||||||
|
|
||||||
GST_INFO ("skeleton fishead parsed total: %" GST_TIME_FORMAT,
|
GST_INFO ("skeleton fishead parsed total: %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (pad->total_time));
|
GST_TIME_ARGS (pad->total_time));
|
||||||
} else if (packet->bytes >= SKELETON_FISHEAD_4_0_MIN_SIZE
|
} else if (packet->bytes - 44 >= SKELETON_FISHEAD_4_0_MIN_SIZE
|
||||||
&& pad->skeleton_major == 4) {
|
&& pad->skeleton_major == 4) {
|
||||||
guint64 segment_length, content_offset;
|
guint64 segment_length, content_offset;
|
||||||
|
|
||||||
|
@ -1980,9 +1970,6 @@ setup_kate_mapper (GstOggStream * pad, ogg_packet * packet)
|
||||||
guint8 *data = packet->packet;
|
guint8 *data = packet->packet;
|
||||||
const char *category;
|
const char *category;
|
||||||
|
|
||||||
if (packet->bytes < 64)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
pad->granulerate_n = GST_READ_UINT32_LE (data + 24);
|
pad->granulerate_n = GST_READ_UINT32_LE (data + 24);
|
||||||
pad->granulerate_d = GST_READ_UINT32_LE (data + 28);
|
pad->granulerate_d = GST_READ_UINT32_LE (data + 28);
|
||||||
pad->granuleshift = GST_READ_UINT8 (data + 15);
|
pad->granuleshift = GST_READ_UINT8 (data + 15);
|
||||||
|
@ -2111,9 +2098,6 @@ setup_opus_mapper (GstOggStream * pad, ogg_packet * packet)
|
||||||
{
|
{
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
|
||||||
if (packet->bytes < 19)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
pad->granulerate_n = 48000;
|
pad->granulerate_n = 48000;
|
||||||
pad->granulerate_d = 1;
|
pad->granulerate_d = 1;
|
||||||
pad->granuleshift = 0;
|
pad->granuleshift = 0;
|
||||||
|
@ -2394,7 +2378,7 @@ const GstOggMap mappers[] = {
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"\001vorbis", 7, 22,
|
"\001vorbis", 7, 29,
|
||||||
"audio/x-vorbis",
|
"audio/x-vorbis",
|
||||||
setup_vorbis_mapper,
|
setup_vorbis_mapper,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2426,7 +2410,7 @@ const GstOggMap mappers[] = {
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"PCM ", 8, 0,
|
"PCM ", 8, 28,
|
||||||
"audio/x-raw",
|
"audio/x-raw",
|
||||||
setup_pcm_mapper,
|
setup_pcm_mapper,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2442,7 +2426,7 @@ const GstOggMap mappers[] = {
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"CMML\0\0\0\0", 8, 0,
|
"CMML\0\0\0\0", 8, 29,
|
||||||
"text/x-cmml",
|
"text/x-cmml",
|
||||||
setup_cmml_mapper,
|
setup_cmml_mapper,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2458,7 +2442,7 @@ const GstOggMap mappers[] = {
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Annodex", 7, 0,
|
"Annodex", 7, 44,
|
||||||
"application/x-annodex",
|
"application/x-annodex",
|
||||||
setup_fishead_mapper,
|
setup_fishead_mapper,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2537,7 +2521,7 @@ const GstOggMap mappers[] = {
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"CELT ", 8, 0,
|
"CELT ", 8, 60,
|
||||||
"audio/x-celt",
|
"audio/x-celt",
|
||||||
setup_celt_mapper,
|
setup_celt_mapper,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2553,7 +2537,7 @@ const GstOggMap mappers[] = {
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"\200kate\0\0\0", 8, 0,
|
"\200kate\0\0\0", 8, 64,
|
||||||
"text/x-kate",
|
"text/x-kate",
|
||||||
setup_kate_mapper,
|
setup_kate_mapper,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2585,7 +2569,7 @@ const GstOggMap mappers[] = {
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"OVP80\1\1", 7, 4,
|
"OVP80\1\1", 7, 26,
|
||||||
"video/x-vp8",
|
"video/x-vp8",
|
||||||
setup_vp8_mapper,
|
setup_vp8_mapper,
|
||||||
setup_vp8_mapper_from_caps,
|
setup_vp8_mapper_from_caps,
|
||||||
|
@ -2601,7 +2585,7 @@ const GstOggMap mappers[] = {
|
||||||
update_stats_vp8
|
update_stats_vp8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"OpusHead", 8, 0,
|
"OpusHead", 8, 19,
|
||||||
"audio/x-opus",
|
"audio/x-opus",
|
||||||
setup_opus_mapper,
|
setup_opus_mapper,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2649,7 +2633,7 @@ const GstOggMap mappers[] = {
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"\001text\0\0\0", 9, 9,
|
"\001text\0\0\0", 9, 25,
|
||||||
"application/x-ogm-text",
|
"application/x-ogm-text",
|
||||||
setup_ogmtext_mapper,
|
setup_ogmtext_mapper,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
Loading…
Reference in a new issue