ext/ogg/gstogmparse.c: Fix crash due to broken bitstream parsing on x86-64: can't make any assumptions about sizeof(s...

Original commit message from CVS:
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
Fix crash due to broken bitstream parsing on x86-64: can't make
any assumptions about sizeof(struct) due to alignment/packing
differences on different architectures. Fixes #351790.
This commit is contained in:
Tim-Philipp Müller 2006-08-23 12:14:20 +00:00
parent 253831a549
commit 7af03fb8b3
3 changed files with 14 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2006-08-23 Tim-Philipp Müller <tim at centricular dot net>
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
Fix crash due to broken bitstream parsing on x86-64: can't make
any assumptions about sizeof(struct) due to alignment/packing
differences on different architectures. Fixes #351790.
2006-08-22 Wim Taymans <wim@fluendo.com>
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_chunk),

2
common

@ -1 +1 @@
Subproject commit e9ea99f6e89d7e1af3a0a859bfeb0ed6ecf2e3a9
Subproject commit d287125f93da692bc25d53b0b7b0e2f90424a212

View file

@ -51,7 +51,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_ogm_parse_debug);
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_OGM_PARSE, GstOgmParse))
#define GST_IS_OGM_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_OGM_PARSE))
#define GST_IS_OGM_PARSE_CLASS(obj) \
#define GST_IS_OGM_PARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_OGM_PARSE))
#define GST_OGM_PARSE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_OGM_PARSE, GstOgmParseClass))
@ -87,6 +87,10 @@ typedef struct _stream_header_audio
gint32 avgbytespersec;
} stream_header_audio;
/* sizeof(stream_header) might differ due to structure packing and
* alignment differences on some architectures, so not using that */
#define OGM_STREAM_HEADER_SIZE (8+4+4+8+8+4+4+4+8)
typedef struct _stream_header
{
gchar streamtype[8];
@ -527,7 +531,7 @@ gst_ogm_parse_chain (GstPad * pad, GstBuffer * buffer)
GstCaps *caps = NULL;
/* stream header */
if (size < sizeof (stream_header) + 1) {
if (size < (1 + OGM_STREAM_HEADER_SIZE)) {
GST_ELEMENT_ERROR (ogm, STREAM, WRONG_TYPE,
("Buffer too small"), (NULL));
break;