mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 21:28:45 +00:00
qtdemux: Check sample count is valid in PIFF parsing
The value stored in cenc_aux_sample_count wasn't in sync with the parsing code that followed which checks whether all entries are valid and present. Only write the actual sample count when we know for sure. CID #1427087
This commit is contained in:
parent
56a1eb65e2
commit
60bc77cc35
1 changed files with 10 additions and 3 deletions
|
@ -2675,6 +2675,7 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
|
||||||
QtDemuxCencSampleSetInfo *ss_info = NULL;
|
QtDemuxCencSampleSetInfo *ss_info = NULL;
|
||||||
const gchar *system_id;
|
const gchar *system_id;
|
||||||
gboolean uses_sub_sample_encryption = FALSE;
|
gboolean uses_sub_sample_encryption = FALSE;
|
||||||
|
guint32 sample_count;
|
||||||
|
|
||||||
if (qtdemux->n_streams == 0)
|
if (qtdemux->n_streams == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -2770,16 +2771,16 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
|
||||||
uses_sub_sample_encryption = TRUE;
|
uses_sub_sample_encryption = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_byte_reader_get_uint32_be (&br, &qtdemux->cenc_aux_sample_count)) {
|
if (!gst_byte_reader_get_uint32_be (&br, &sample_count)) {
|
||||||
GST_ERROR_OBJECT (qtdemux, "Error getting box's sample count field");
|
GST_ERROR_OBJECT (qtdemux, "Error getting box's sample count field");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ss_info->crypto_info =
|
ss_info->crypto_info =
|
||||||
g_ptr_array_new_full (qtdemux->cenc_aux_sample_count,
|
g_ptr_array_new_full (sample_count,
|
||||||
(GDestroyNotify) qtdemux_gst_structure_free);
|
(GDestroyNotify) qtdemux_gst_structure_free);
|
||||||
|
|
||||||
for (i = 0; i < qtdemux->cenc_aux_sample_count; ++i) {
|
for (i = 0; i < sample_count; ++i) {
|
||||||
GstStructure *properties;
|
GstStructure *properties;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
@ -2787,12 +2788,14 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
|
||||||
properties = qtdemux_get_cenc_sample_properties (qtdemux, stream, i);
|
properties = qtdemux_get_cenc_sample_properties (qtdemux, stream, i);
|
||||||
if (properties == NULL) {
|
if (properties == NULL) {
|
||||||
GST_ERROR_OBJECT (qtdemux, "failed to get properties for sample %u", i);
|
GST_ERROR_OBJECT (qtdemux, "failed to get properties for sample %u", i);
|
||||||
|
qtdemux->cenc_aux_sample_count = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_byte_reader_dup_data (&br, iv_size, &data)) {
|
if (!gst_byte_reader_dup_data (&br, iv_size, &data)) {
|
||||||
GST_ERROR_OBJECT (qtdemux, "IV data not present for sample %u", i);
|
GST_ERROR_OBJECT (qtdemux, "IV data not present for sample %u", i);
|
||||||
gst_structure_free (properties);
|
gst_structure_free (properties);
|
||||||
|
qtdemux->cenc_aux_sample_count = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buf = gst_buffer_new_wrapped (data, iv_size);
|
buf = gst_buffer_new_wrapped (data, iv_size);
|
||||||
|
@ -2807,6 +2810,7 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
|
||||||
GST_ERROR_OBJECT (qtdemux,
|
GST_ERROR_OBJECT (qtdemux,
|
||||||
"failed to get subsample count for sample %u", i);
|
"failed to get subsample count for sample %u", i);
|
||||||
gst_structure_free (properties);
|
gst_structure_free (properties);
|
||||||
|
qtdemux->cenc_aux_sample_count = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GST_LOG_OBJECT (qtdemux, "subsample count: %u", n_subsamples);
|
GST_LOG_OBJECT (qtdemux, "subsample count: %u", n_subsamples);
|
||||||
|
@ -2814,6 +2818,7 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
|
||||||
GST_ERROR_OBJECT (qtdemux, "failed to get subsample data for sample %u",
|
GST_ERROR_OBJECT (qtdemux, "failed to get subsample data for sample %u",
|
||||||
i);
|
i);
|
||||||
gst_structure_free (properties);
|
gst_structure_free (properties);
|
||||||
|
qtdemux->cenc_aux_sample_count = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buf = gst_buffer_new_wrapped (data, n_subsamples * 6);
|
buf = gst_buffer_new_wrapped (data, n_subsamples * 6);
|
||||||
|
@ -2827,6 +2832,8 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
|
||||||
|
|
||||||
g_ptr_array_add (ss_info->crypto_info, properties);
|
g_ptr_array_add (ss_info->crypto_info, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qtdemux->cenc_aux_sample_count = sample_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue