Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
b3664586
Commit
b3664586
authored
Oct 08, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: ogg: fix use after free (fix #12360)
parent
dde5f4af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
modules/demux/ogg.c
modules/demux/ogg.c
+17
-12
No files found.
modules/demux/ogg.c
View file @
b3664586
...
@@ -1460,7 +1460,6 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1460,7 +1460,6 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
demux_sys_t
*
p_ogg
=
p_demux
->
p_sys
;
demux_sys_t
*
p_ogg
=
p_demux
->
p_sys
;
ogg_packet
oggpacket
;
ogg_packet
oggpacket
;
int
i_stream
=
0
;
p_ogg
->
i_total_length
=
stream_Size
(
p_demux
->
s
);
p_ogg
->
i_total_length
=
stream_Size
(
p_demux
->
s
);
msg_Dbg
(
p_demux
,
"File length is %"
PRId64
" bytes"
,
p_ogg
->
i_total_length
);
msg_Dbg
(
p_demux
,
"File length is %"
PRId64
" bytes"
,
p_ogg
->
i_total_length
);
...
@@ -1476,16 +1475,12 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1476,16 +1475,12 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
* We found the beginning of our first logical stream. */
* We found the beginning of our first logical stream. */
while
(
ogg_page_bos
(
&
p_ogg
->
current_page
)
)
while
(
ogg_page_bos
(
&
p_ogg
->
current_page
)
)
{
{
logical_stream_t
*
p_stream
;
logical_stream_t
*
p_stream
=
calloc
(
1
,
sizeof
(
logical_stream_t
)
);
p_stream
=
malloc
(
sizeof
(
logical_stream_t
)
);
if
(
unlikely
(
!
p_stream
)
)
if
(
unlikely
(
!
p_stream
)
)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
TAB_APPEND
(
p_ogg
->
i_streams
,
p_ogg
->
pp_stream
,
p_stream
);
TAB_APPEND
(
p_ogg
->
i_streams
,
p_ogg
->
pp_stream
,
p_stream
);
memset
(
p_stream
,
0
,
sizeof
(
logical_stream_t
)
);
es_format_Init
(
&
p_stream
->
fmt
,
0
,
0
);
es_format_Init
(
&
p_stream
->
fmt
,
0
,
0
);
es_format_Init
(
&
p_stream
->
fmt_old
,
0
,
0
);
es_format_Init
(
&
p_stream
->
fmt_old
,
0
,
0
);
p_stream
->
b_initializing
=
true
;
p_stream
->
b_initializing
=
true
;
...
@@ -1517,6 +1512,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1517,6 +1512,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"found invalid vorbis header"
);
msg_Dbg
(
p_demux
,
"found invalid vorbis header"
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
p_stream
=
NULL
;
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1535,6 +1531,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1535,6 +1531,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"found invalid Speex header"
);
msg_Dbg
(
p_demux
,
"found invalid Speex header"
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
p_stream
=
NULL
;
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1583,6 +1580,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1583,6 +1580,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"found invalid Flac header"
);
msg_Dbg
(
p_demux
,
"found invalid Flac header"
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
p_stream
=
NULL
;
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1598,6 +1596,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1598,6 +1596,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"found invalid Theora header"
);
msg_Dbg
(
p_demux
,
"found invalid Theora header"
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
p_stream
=
NULL
;
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1628,6 +1627,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1628,6 +1627,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Warn
(
p_demux
,
"found dirac header isn't decodable"
);
msg_Warn
(
p_demux
,
"found dirac header isn't decodable"
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
p_stream
=
NULL
;
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1665,6 +1665,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1665,6 +1665,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"invalid VP8 header found"
);
msg_Dbg
(
p_demux
,
"invalid VP8 header found"
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
p_stream
=
NULL
;
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1674,7 +1675,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1674,7 +1675,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
Ogg_ReadAnnodexHeader
(
p_demux
,
p_stream
,
&
oggpacket
);
Ogg_ReadAnnodexHeader
(
p_demux
,
p_stream
,
&
oggpacket
);
/* kill annodex track */
/* kill annodex track */
free
(
p_stream
);
FREENULL
(
p_stream
);
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
/* Check for Annodex header */
/* Check for Annodex header */
...
@@ -1693,6 +1694,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1693,6 +1694,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"invalid kate header found"
);
msg_Dbg
(
p_demux
,
"invalid kate header found"
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
p_stream
=
NULL
;
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1798,6 +1800,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1798,6 +1800,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"invalid oggds audio header"
);
msg_Dbg
(
p_demux
,
"invalid oggds audio header"
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
p_stream
=
NULL
;
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1805,7 +1808,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1805,7 +1808,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"stream %d has an old header "
msg_Dbg
(
p_demux
,
"stream %d has an old header "
"but is of an unknown type"
,
p_ogg
->
i_streams
-
1
);
"but is of an unknown type"
,
p_ogg
->
i_streams
-
1
);
free
(
p_stream
);
FREENULL
(
p_stream
);
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1928,6 +1931,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1928,6 +1931,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"invalid oggds audio header"
);
msg_Dbg
(
p_demux
,
"invalid oggds audio header"
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
Ogg_LogicalStreamDelete
(
p_demux
,
p_stream
);
p_stream
=
NULL
;
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1946,7 +1950,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1946,7 +1950,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"stream %d has a header marker "
msg_Dbg
(
p_demux
,
"stream %d has a header marker "
"but is of an unknown type"
,
p_ogg
->
i_streams
-
1
);
"but is of an unknown type"
,
p_ogg
->
i_streams
-
1
);
free
(
p_stream
);
FREENULL
(
p_stream
);
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
}
}
...
@@ -1963,12 +1967,13 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1963,12 +1967,13 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
{
{
msg_Dbg
(
p_demux
,
"stream %d is of unknown type"
,
msg_Dbg
(
p_demux
,
"stream %d is of unknown type"
,
p_ogg
->
i_streams
-
1
);
p_ogg
->
i_streams
-
1
);
free
(
p_stream
);
FREENULL
(
p_stream
);
p_ogg
->
i_streams
--
;
p_ogg
->
i_streams
--
;
}
}
/* we'll need to get all headers */
/* we'll need to get all headers */
p_ogg
->
pp_stream
[
i_stream
]
->
b_initializing
&=
p_ogg
->
pp_stream
[
i_stream
]
->
b_force_backup
;
if
(
p_stream
)
p_stream
->
b_initializing
&=
p_stream
->
b_force_backup
;
if
(
Ogg_ReadPage
(
p_demux
,
&
p_ogg
->
current_page
)
!=
VLC_SUCCESS
)
if
(
Ogg_ReadPage
(
p_demux
,
&
p_ogg
->
current_page
)
!=
VLC_SUCCESS
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -1977,7 +1982,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
...
@@ -1977,7 +1982,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
/* This is the first data page, which means we are now finished
/* This is the first data page, which means we are now finished
* with the initial pages. We just need to store it in the relevant
* with the initial pages. We just need to store it in the relevant
* bitstream. */
* bitstream. */
for
(
i_stream
=
0
;
i_stream
<
p_ogg
->
i_streams
;
i_stream
++
)
for
(
i
nt
i
_stream
=
0
;
i_stream
<
p_ogg
->
i_streams
;
i_stream
++
)
{
{
if
(
ogg_stream_pagein
(
&
p_ogg
->
pp_stream
[
i_stream
]
->
os
,
if
(
ogg_stream_pagein
(
&
p_ogg
->
pp_stream
[
i_stream
]
->
os
,
&
p_ogg
->
current_page
)
==
0
)
&
p_ogg
->
current_page
)
==
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment