gst/asfdemux/gstasfdemux.c: don't write to memory we might not write to - g_convert does that for us anyway conmment ...

Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_process_comment):
don't write to memory we might not write to - g_convert does that
for us anyway
(gst_asf_demux_audio_caps):
conmment out gst_util_dump_mem
This commit is contained in:
Benjamin Otte 2004-05-16 16:22:42 +00:00
parent 54e790ae50
commit c6f1c50f75
2 changed files with 18 additions and 9 deletions

View file

@ -1,3 +1,11 @@
2004-05-16 Benjamin Otte <otte@gnome.org>
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_process_comment):
don't write to memory we might not write to - g_convert does that
for us anyway
(gst_asf_demux_audio_caps):
conmment out gst_util_dump_mem
2004-05-16 Benjamin Otte <otte@gnome.org>
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):

View file

@ -526,7 +526,7 @@ gst_asf_demux_process_comment (GstASFDemux * asf_demux, guint64 * obj_size)
GST_TAG_COMMENT, NULL /* ? */
};
guint16 *lengths = (guint16 *) & object;
gint i, n;
gint i;
gsize in, out;
GstTagList *taglist;
const GList *padlist;
@ -545,17 +545,18 @@ gst_asf_demux_process_comment (GstASFDemux * asf_demux, guint64 * obj_size)
if (lengths[i] > 2 && lengths[i] % 2 == 0) {
if (gst_bytestream_peek_bytes (bs, &data, lengths[i]) != lengths[i])
goto fail;
gst_bytestream_flush_fast (bs, lengths[i]);
/* check null-termination (malicious input) */
if (data[lengths[i] - 1] != '\0' || data[lengths[i] - 2] != '\0')
if (data[lengths[i] - 1] != '\0' || data[lengths[i] - 2] != '\0') {
gst_bytestream_flush_fast (bs, lengths[i]);
continue;
}
/* convert to UTF-8 */
for (n = 0; n < lengths[i] / 2 - 1; n++)
((gint16 *) data)[n] = GUINT16_FROM_LE (((gint16 *) data)[n]);
utf8_comments[i] = g_convert (data, lengths[i],
"UTF-8", "Unicode", &in, &out, NULL);
"UTF-8", "UTF-16LE", &in, &out, NULL);
gst_bytestream_flush_fast (bs, lengths[i]);
} else {
if (lengths[i] > 0 && !gst_bytestream_flush (bs, lengths[i]))
goto fail;
@ -1485,7 +1486,7 @@ gst_asf_demux_audio_caps (guint16 codec_id,
buffer = gst_buffer_new_and_alloc (audio->size);
memcpy (GST_BUFFER_DATA (buffer), extradata, audio->size);
gst_util_dump_mem (GST_BUFFER_DATA (buffer), audio->size);
/* gst_util_dump_mem (GST_BUFFER_DATA (buffer), audio->size); */
gst_caps_set_simple (caps,
"codec_data", GST_TYPE_BUFFER, buffer,
@ -1505,7 +1506,7 @@ gst_asf_demux_audio_caps (guint16 codec_id,
buffer = gst_buffer_new_and_alloc (audio->size);
memcpy (GST_BUFFER_DATA (buffer), extradata, audio->size);
gst_util_dump_mem (GST_BUFFER_DATA (buffer), audio->size);
/* gst_util_dump_mem (GST_BUFFER_DATA (buffer), audio->size); */
gst_caps_set_simple (caps,
"codec_data", GST_TYPE_BUFFER, buffer,