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
48a01700
Commit
48a01700
authored
Aug 28, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat: fix heap read overflow and invalid cast
avformat needs nul padding after the probe data.
parent
13ba7e5e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
9 deletions
+24
-9
modules/demux/avformat/demux.c
modules/demux/avformat/demux.c
+24
-9
No files found.
modules/demux/avformat/demux.c
View file @
48a01700
...
...
@@ -163,8 +163,24 @@ int OpenDemux( vlc_object_t *p_this )
int64_t
i_start_time
=
-
1
;
bool
b_can_seek
;
char
*
psz_url
;
const
uint8_t
*
peek
;
int
error
;
/* Init Probe data */
pd
.
buf_size
=
stream_Peek
(
p_demux
->
s
,
&
peek
,
2048
+
213
);
if
(
pd
.
buf_size
<=
0
)
{
msg_Warn
(
p_demux
,
"cannot peek"
);
return
VLC_EGENERIC
;
}
pd
.
buf
=
malloc
(
pd
.
buf_size
+
AVPROBE_PADDING_SIZE
);
if
(
unlikely
(
pd
.
buf
==
NULL
)
)
return
VLC_ENOMEM
;
memcpy
(
pd
.
buf
,
peek
,
pd
.
buf_size
);
memset
(
pd
.
buf
+
pd
.
buf_size
,
0
,
AVPROBE_PADDING_SIZE
);
if
(
p_demux
->
psz_file
)
psz_url
=
strdup
(
p_demux
->
psz_file
);
else
...
...
@@ -177,18 +193,13 @@ int OpenDemux( vlc_object_t *p_this )
if
(
psz_url
!=
NULL
)
msg_Dbg
(
p_demux
,
"trying url: %s"
,
psz_url
);
/* Init Probe data */
pd
.
filename
=
psz_url
;
if
(
(
pd
.
buf_size
=
stream_Peek
(
p_demux
->
s
,
(
const
uint8_t
**
)
&
pd
.
buf
,
2048
+
213
)
)
<=
0
)
{
free
(
psz_url
);
msg_Warn
(
p_demux
,
"cannot peek"
);
return
VLC_EGENERIC
;
}
stream_Control
(
p_demux
->
s
,
STREAM_CAN_SEEK
,
&
b_can_seek
);
vlc_init_avformat
(
p_this
);
/* Guess format */
char
*
psz_format
=
var_InheritString
(
p_this
,
"avformat-format"
);
if
(
psz_format
)
{
...
...
@@ -197,8 +208,12 @@ int OpenDemux( vlc_object_t *p_this )
free
(
psz_format
);
}
/* Guess format */
if
(
!
fmt
&&
!
(
fmt
=
av_probe_input_format
(
&
pd
,
1
)
)
)
if
(
fmt
==
NULL
)
fmt
=
av_probe_input_format
(
&
pd
,
1
);
free
(
pd
.
buf
);
if
(
fmt
==
NULL
)
{
msg_Dbg
(
p_demux
,
"couldn't guess format"
);
free
(
psz_url
);
...
...
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