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
3068f1c8
Commit
3068f1c8
authored
Aug 01, 2006
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid reading beyond packet size
Originally committed as revision 5878 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
9c050969
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
gxfenc.c
libavformat/gxfenc.c
+6
-8
No files found.
libavformat/gxfenc.c
View file @
3068f1c8
...
...
@@ -724,14 +724,13 @@ static int gxf_write_media_packet(ByteIOContext *pb, GXFContext *ctx, AVPacket *
gxf_write_packet_header
(
pb
,
PKT_MEDIA
);
if
(
sc
->
codec
->
codec_id
==
CODEC_ID_MPEG2VIDEO
&&
pkt
->
size
%
4
)
/* MPEG-2 frames must be padded */
padding
=
4
-
pkt
->
size
%
4
;
else
if
(
sc
->
codec
->
codec_type
==
CODEC_TYPE_AUDIO
)
padding
=
GXF_AUDIO_PACKET_SIZE
-
pkt
->
size
;
gxf_write_media_preamble
(
pb
,
ctx
,
pkt
,
pkt
->
size
+
padding
);
if
(
sc
->
codec
->
codec_type
==
CODEC_TYPE_AUDIO
)
put_buffer
(
pb
,
pkt
->
data
,
GXF_AUDIO_PACKET_SIZE
);
else
{
ctx
->
field_number
+=
2
;
put_buffer
(
pb
,
pkt
->
data
,
pkt
->
size
);
}
put_buffer
(
pb
,
pkt
->
data
,
pkt
->
size
);
gxf_write_padding
(
pb
,
padding
);
if
(
sc
->
codec
->
codec_type
==
CODEC_TYPE_VIDEO
)
ctx
->
field_number
+=
2
;
return
updatePacketSize
(
pb
,
pos
);
}
...
...
@@ -793,11 +792,10 @@ static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pk
if
(
sc
->
codec
->
codec_type
==
CODEC_TYPE_AUDIO
&&
(
flush
||
fifo_size
(
&
sc
->
audio_buffer
,
NULL
)
>=
GXF_AUDIO_PACKET_SIZE
))
{
int
size
=
flush
?
fifo_size
(
&
sc
->
audio_buffer
,
NULL
)
:
GXF_AUDIO_PACKET_SIZE
;
av_new_packet
(
out
,
GXF_AUDIO_PACKET_SIZE
);
av_new_packet
(
out
,
size
);
fifo_read
(
&
sc
->
audio_buffer
,
out
->
data
,
size
,
NULL
);
gxf
->
audio_written
++
;
out
->
stream_index
=
i
;
out
->
size
=
size
;
return
1
;
}
}
...
...
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