mpegtsdemux: catch prev-not-found when inserting in the group list

While this probably should never happen if callers are well behaved,
this avoids a crash if it does. With a warning about it. Unsure if
it'd be better to not add at all, but it should not happen...

Coverity 1139713
This commit is contained in:
Vincent Penquerc'h 2014-04-09 14:13:46 +01:00
parent d47727c032
commit f255422ec2

View file

@ -1720,6 +1720,11 @@ _insert_group_after (MpegTSPCR * pcrtable, PCROffsetGroup * group,
break; break;
} }
} }
if (!prevlist) {
/* The non NULL prev given isn't in the list */
GST_WARNING ("Request to insert before a group which isn't in the list");
pcrtable->groups = g_list_prepend (pcrtable->groups, group);
} else {
toinsert = g_list_append (NULL, group); toinsert = g_list_append (NULL, group);
toinsert->next = nextlist; toinsert->next = nextlist;
toinsert->prev = prevlist; toinsert->prev = prevlist;
@ -1728,6 +1733,7 @@ _insert_group_after (MpegTSPCR * pcrtable, PCROffsetGroup * group,
nextlist->prev = toinsert; nextlist->prev = toinsert;
} }
} }
}
static void static void
_use_group (MpegTSPCR * pcrtable, PCROffsetGroup * group) _use_group (MpegTSPCR * pcrtable, PCROffsetGroup * group)