diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2009-08-20 01:39:17 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2009-09-24 16:28:40 +0100 |
commit | 9da3ed6491693f2a227bcfa10f1598f1f7fad22f (patch) | |
tree | 4d6da583fce338bfc37f610576096487594252d7 /gst/qtdemux/qtdemux.c | |
parent | a16feec38ece90d629634a813eaf2b056e7d646e (diff) |
qtdemux: add qt_atom_parse_has_remaining() to avoid overflows with _get_remaining()
Diffstat (limited to 'gst/qtdemux/qtdemux.c')
-rw-r--r-- | gst/qtdemux/qtdemux.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index fbfd6d08..f9a7eed0 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -3573,7 +3573,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream, /* set the sample sizes */ if (sample_size == 0) { /* different sizes for each sample */ - if (qt_atom_parser_get_remaining (&stsz) < 4 * (n_samples)) + if (!qt_atom_parser_has_remaining (&stsz, 4 * n_samples)) goto corrupt_file; for (i = 0; i < n_samples; i++) { @@ -3592,7 +3592,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream, !qt_atom_parser_get_uint32 (&stsc, &n_samples_per_chunk)) goto corrupt_file; - if (qt_atom_parser_get_remaining (&stsc) < 12 * n_samples_per_chunk) + if (!qt_atom_parser_has_remaining (&stsc, 12 * n_samples_per_chunk)) goto corrupt_file; index = 0; @@ -3665,7 +3665,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream, GST_LOG_OBJECT (qtdemux, "%u timestamp blocks", n_sample_times); /* make sure there's enough data */ - if (qt_atom_parser_get_remaining (&stts) < (n_sample_times * (2 * 4))) + if (!qt_atom_parser_has_remaining (&stts, n_sample_times * (2 * 4))) goto corrupt_file; timestamp = 0; @@ -3732,7 +3732,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream, stream->all_keyframe = TRUE; } else { /* make sure there's enough data */ - if (qt_atom_parser_get_remaining (&stss) < (n_sample_syncs * 4)) + if (!qt_atom_parser_has_remaining (&stss, n_sample_syncs * 4)) goto corrupt_file; for (i = 0; i < n_sample_syncs; i++) { /* note that the first sample is index 1, not 0 */ @@ -3755,7 +3755,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream, * samples */ } else { /* make sure there's enough data */ - if (qt_atom_parser_get_remaining (&stps) < (n_sample_syncs * 4)) + if (!qt_atom_parser_has_remaining (&stps, n_sample_syncs * 4)) goto corrupt_file; for (i = 0; i < n_sample_syncs; i++) { /* note that the first sample is index 1, not 0 */ @@ -3802,7 +3802,7 @@ qtdemux_parse_samples (GstQTDemux * qtdemux, QtDemuxStream * stream, sample_index = 0; timestamp = 0; - if (qt_atom_parser_get_remaining (&stsc) < 12 * n_samples_per_chunk) + if (!qt_atom_parser_has_remaining (&stsc, 12 * n_samples_per_chunk)) goto corrupt_file; for (i = 0; i < n_samples_per_chunk; i++) { |