From 17a6a7417c2bfdb3cb7fbe3f18c548722b2695ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 11 Feb 2008 13:29:07 +0000 Subject: [PATCH] gst/mpegaudioparse/gstxingmux.c: Correctly write the size in bytes on big endian systems. Original commit message from CVS: * gst/mpegaudioparse/gstxingmux.c: (generate_xing_header): Correctly write the size in bytes on big endian systems. Fixes bug #515725. --- ChangeLog | 6 ++++++ gst/mpegaudioparse/gstxingmux.c | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca69d97d5f..bc3924320b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-11 Sebastian Dröge + + * gst/mpegaudioparse/gstxingmux.c: (generate_xing_header): + Correctly write the size in bytes on big endian systems. + Fixes bug #515725. + 2008-02-11 Sebastian Dröge * ext/lame/gstlame.c: (gst_lame_setup): diff --git a/gst/mpegaudioparse/gstxingmux.c b/gst/mpegaudioparse/gstxingmux.c index 32d757ac64..10f843b130 100644 --- a/gst/mpegaudioparse/gstxingmux.c +++ b/gst/mpegaudioparse/gstxingmux.c @@ -330,12 +330,19 @@ generate_xing_header (GstXingMux * xing) } if (byte_count != 0) { - GST_DEBUG ("Setting number of bytes to %u", byte_count); - byte_count = GUINT32_TO_BE (byte_count); - memcpy (data, &byte_count, 4); - *xing_flags |= GST_XING_BYTES_FIELD; - data += 4; - byte_count = GUINT32_FROM_BE (byte_count); + guint32 nbytes; + + if (byte_count > G_MAXUINT32) { + GST_DEBUG ("Too large stream: %" G_GINT64_FORMAT " > %" G_GINT64_FORMAT + " bytes", byte_count, G_MAXUINT32); + } else { + nbytes = byte_count; + GST_DEBUG ("Setting number of bytes to %u", nbytes); + nbytes = GUINT32_TO_BE (nbytes); + memcpy (data, &nbytes, 4); + *xing_flags |= GST_XING_BYTES_FIELD; + data += 4; + } } if (xing->seek_table != NULL && byte_count != 0