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
9fba8ebe
Commit
9fba8ebe
authored
Sep 23, 2011
by
Alex Converse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegps: Handle buffer exhaustion when reading packets.
parent
0c378ea1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
mpeg.c
libavformat/mpeg.c
+9
-3
No files found.
libavformat/mpeg.c
View file @
9fba8ebe
...
...
@@ -418,7 +418,7 @@ static int mpegps_read_packet(AVFormatContext *s,
{
MpegDemuxContext
*
m
=
s
->
priv_data
;
AVStream
*
st
;
int
len
,
startcode
,
i
,
es_type
;
int
len
,
startcode
,
i
,
es_type
,
ret
;
enum
CodecID
codec_id
=
CODEC_ID_NONE
;
enum
AVMediaType
type
;
int64_t
pts
,
dts
,
dummy_pos
;
//dummy_pos is needed for the index building to work
...
...
@@ -562,7 +562,13 @@ static int mpegps_read_packet(AVFormatContext *s,
return
AVERROR
(
EINVAL
);
}
av_new_packet
(
pkt
,
len
);
avio_read
(
s
->
pb
,
pkt
->
data
,
pkt
->
size
);
ret
=
avio_read
(
s
->
pb
,
pkt
->
data
,
pkt
->
size
);
if
(
ret
<
0
)
{
pkt
->
size
=
0
;
}
else
if
(
ret
<
pkt
->
size
)
{
pkt
->
size
=
ret
;
memset
(
pkt
->
data
+
ret
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
}
pkt
->
pts
=
pts
;
pkt
->
dts
=
dts
;
pkt
->
pos
=
dummy_pos
;
...
...
@@ -571,7 +577,7 @@ static int mpegps_read_packet(AVFormatContext *s,
pkt
->
stream_index
,
pkt
->
pts
/
90000
.
0
,
pkt
->
dts
/
90000
.
0
,
pkt
->
size
);
return
0
;
return
(
ret
<
0
)
?
ret
:
0
;
}
static
int64_t
mpegps_read_dts
(
AVFormatContext
*
s
,
int
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