mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
demux: fix some theoretical UB with no impact
If the number of chapters is 0, the chapter list can be NULL. clang complains that we pass NULL to qsort(). This is yet another pointless UB that exists for no reason other than wasting your time.
This commit is contained in:
@@ -3027,8 +3027,10 @@ static int chapter_compare(const void *p1, const void *p2)
|
||||
|
||||
static void demuxer_sort_chapters(demuxer_t *demuxer)
|
||||
{
|
||||
qsort(demuxer->chapters, demuxer->num_chapters,
|
||||
sizeof(struct demux_chapter), chapter_compare);
|
||||
if (demuxer->num_chapters) {
|
||||
qsort(demuxer->chapters, demuxer->num_chapters,
|
||||
sizeof(struct demux_chapter), chapter_compare);
|
||||
}
|
||||
}
|
||||
|
||||
int demuxer_add_chapter(demuxer_t *demuxer, char *name,
|
||||
|
||||
Reference in New Issue
Block a user