Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
7b03b65b
Commit
7b03b65b
authored
Jan 20, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf: do basic sanity checking on muxed packets
Reject packets for non-existing or attachment streams.
parent
5de64bb3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
mux.c
libavformat/mux.c
+27
-0
No files found.
libavformat/mux.c
View file @
7b03b65b
...
...
@@ -429,10 +429,33 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
return
ret
;
}
static
int
check_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
if
(
!
pkt
)
return
0
;
if
(
pkt
->
stream_index
<
0
||
pkt
->
stream_index
>=
s
->
nb_streams
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid packet stream index: %d
\n
"
,
pkt
->
stream_index
);
return
AVERROR
(
EINVAL
);
}
if
(
s
->
streams
[
pkt
->
stream_index
]
->
codec
->
codec_type
==
AVMEDIA_TYPE_ATTACHMENT
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Received a packet for an attachment stream.
\n
"
);
return
AVERROR
(
EINVAL
);
}
return
0
;
}
int
av_write_frame
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
int
ret
;
ret
=
check_packet
(
s
,
pkt
);
if
(
ret
<
0
)
return
ret
;
if
(
!
pkt
)
{
if
(
s
->
oformat
->
flags
&
AVFMT_ALLOW_FLUSH
)
return
s
->
oformat
->
write_packet
(
s
,
pkt
);
...
...
@@ -560,6 +583,10 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
{
int
ret
,
flush
=
0
;
ret
=
check_packet
(
s
,
pkt
);
if
(
ret
<
0
)
return
ret
;
if
(
pkt
)
{
AVStream
*
st
=
s
->
streams
[
pkt
->
stream_index
];
...
...
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