mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
gst/typefind/gsttypefindfunctions.c: Don't modify scan context when we return FALSE in ensure_data, so it's possible ...
Original commit message from CVS: * gst/typefind/gsttypefindfunctions.c: (data_scan_ctx_ensure_data), (mpeg_sys_is_valid_pack): Don't modify scan context when we return FALSE in ensure_data, so it's possible to continue scanning, and we don't end up with a NULL data pointer and a positive size, which might bite us the next time we're called. Small constification.
This commit is contained in:
parent
05cf63634e
commit
cfc8f3c0d7
3 changed files with 19 additions and 7 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2008-05-19 Tim-Philipp Müller <tim.muller at collabora co uk>
|
||||||
|
|
||||||
|
* gst/typefind/gsttypefindfunctions.c: (data_scan_ctx_ensure_data),
|
||||||
|
(mpeg_sys_is_valid_pack):
|
||||||
|
Don't modify scan context when we return FALSE in ensure_data, so
|
||||||
|
it's possible to continue scanning, and we don't end up with a NULL
|
||||||
|
data pointer and a positive size, which might bite us the next time
|
||||||
|
we're called. Small constification.
|
||||||
|
|
||||||
2008-05-16 Sebastian Dröge <slomo@circular-chaos.org>
|
2008-05-16 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
* gst/adder/gstadder.c:
|
* gst/adder/gstadder.c:
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 3b3631082d04b426f450810e8836de94e9c5d60a
|
Subproject commit e365978c480a8fffa4bdb61568fb2cd989d1b197
|
|
@ -45,7 +45,7 @@ GST_DEBUG_CATEGORY_STATIC (type_find_debug);
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
guint64 offset;
|
guint64 offset;
|
||||||
guint8 *data;
|
const guint8 *data;
|
||||||
gint size;
|
gint size;
|
||||||
} DataScanCtx;
|
} DataScanCtx;
|
||||||
|
|
||||||
|
@ -65,13 +65,15 @@ data_scan_ctx_advance (GstTypeFind * tf, DataScanCtx * c, guint bytes_to_skip)
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
data_scan_ctx_ensure_data (GstTypeFind * tf, DataScanCtx * c, gint min_len)
|
data_scan_ctx_ensure_data (GstTypeFind * tf, DataScanCtx * c, gint min_len)
|
||||||
{
|
{
|
||||||
|
const guint8 *data;
|
||||||
guint64 len;
|
guint64 len;
|
||||||
|
|
||||||
if (G_LIKELY (c->size >= min_len))
|
if (G_LIKELY (c->size >= min_len))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
c->data = gst_type_find_peek (tf, c->offset, DATA_SCAN_CTX_CHUNK_SIZE);
|
data = gst_type_find_peek (tf, c->offset, DATA_SCAN_CTX_CHUNK_SIZE);
|
||||||
if (G_LIKELY (c->data != NULL)) {
|
if (G_LIKELY (data != NULL)) {
|
||||||
|
c->data = data;
|
||||||
c->size = DATA_SCAN_CTX_CHUNK_SIZE;
|
c->size = DATA_SCAN_CTX_CHUNK_SIZE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -86,8 +88,9 @@ data_scan_ctx_ensure_data (GstTypeFind * tf, DataScanCtx * c, gint min_len)
|
||||||
len = min_len;
|
len = min_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->data = gst_type_find_peek (tf, c->offset, len);
|
data = gst_type_find_peek (tf, c->offset, len);
|
||||||
if (c->data != NULL) {
|
if (data != NULL) {
|
||||||
|
c->data = data;
|
||||||
c->size = len;
|
c->size = len;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1241,7 +1244,7 @@ static GstStaticCaps mpeg_sys_caps = GST_STATIC_CAPS ("video/mpeg, "
|
||||||
#define MPEG2_MAX_SYS_HEADERS 5
|
#define MPEG2_MAX_SYS_HEADERS 5
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
mpeg_sys_is_valid_pack (GstTypeFind * tf, guint8 * data, guint len,
|
mpeg_sys_is_valid_pack (GstTypeFind * tf, const guint8 * data, guint len,
|
||||||
guint * pack_size)
|
guint * pack_size)
|
||||||
{
|
{
|
||||||
/* Check the pack header @ offset for validity, assuming that the 4 byte header
|
/* Check the pack header @ offset for validity, assuming that the 4 byte header
|
||||||
|
|
Loading…
Reference in a new issue