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
dac030d3
Commit
dac030d3
authored
May 29, 2016
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/movenc: Fix potential track width/height overflows
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
17d32080
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
movenc.c
libavformat/movenc.c
+13
-9
No files found.
libavformat/movenc.c
View file @
dac030d3
...
...
@@ -2444,24 +2444,28 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov,
/* Track width and height, for visual only */
if
(
st
&&
(
track
->
par
->
codec_type
==
AVMEDIA_TYPE_VIDEO
||
track
->
par
->
codec_type
==
AVMEDIA_TYPE_SUBTITLE
))
{
int64_t
track_width_1616
;
if
(
track
->
mode
==
MODE_MOV
)
{
avio_wb32
(
pb
,
track
->
par
->
width
<<
16
);
avio_wb32
(
pb
,
track
->
height
<<
16
);
track_width_1616
=
track
->
par
->
width
*
0x10000ULL
;
}
else
{
int64_t
track_width_1616
=
av_rescale
(
st
->
sample_aspect_ratio
.
num
,
track_width_1616
=
av_rescale
(
st
->
sample_aspect_ratio
.
num
,
track
->
par
->
width
*
0x10000LL
,
st
->
sample_aspect_ratio
.
den
);
if
(
!
track_width_1616
||
track
->
height
!=
track
->
par
->
height
||
track_width_1616
>
UINT32_MAX
)
track_width_1616
=
track
->
par
->
width
*
0x10000ULL
;
}
if
(
track_width_1616
>
UINT32_MAX
)
{
av_log
(
mov
->
fc
,
AV_LOG_WARNING
,
"track width
too large
\n
"
);
av_log
(
mov
->
fc
,
AV_LOG_WARNING
,
"track width is
too large
\n
"
);
track_width_1616
=
0
;
}
avio_wb32
(
pb
,
track_width_1616
);
if
(
track
->
height
>
0xFFFF
)
{
av_log
(
mov
->
fc
,
AV_LOG_WARNING
,
"track height is too large
\n
"
);
avio_wb32
(
pb
,
0
);
}
else
avio_wb32
(
pb
,
track
->
height
*
0x10000U
);
}
}
else
{
avio_wb32
(
pb
,
0
);
avio_wb32
(
pb
,
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