Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
69c1fe7c
Commit
69c1fe7c
authored
Oct 29, 2014
by
Luca Barbato
Committed by
Vittorio Giovara
Dec 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv: Validate ASS Start and End fields
CC: libav-stable@libav.org
parent
7834a54c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
matroskaenc.c
libavformat/matroskaenc.c
+19
-2
No files found.
libavformat/matroskaenc.c
View file @
69c1fe7c
...
...
@@ -1227,7 +1227,7 @@ static int mkv_blockgroup_size(int pkt_size)
return
size
;
}
static
int
ass_get_duration
(
const
uint8_t
*
p
)
static
int
ass_get_duration
(
AVFormatContext
*
s
,
const
uint8_t
*
p
)
{
int
sh
,
sm
,
ss
,
sc
,
eh
,
em
,
es
,
ec
;
uint64_t
start
,
end
;
...
...
@@ -1235,8 +1235,25 @@ static int ass_get_duration(const uint8_t *p)
if
(
sscanf
(
p
,
"%*[^,],%d:%d:%d%*c%d,%d:%d:%d%*c%d"
,
&
sh
,
&
sm
,
&
ss
,
&
sc
,
&
eh
,
&
em
,
&
es
,
&
ec
)
!=
8
)
return
0
;
if
(
sh
>
9
||
sm
>
59
||
ss
>
59
||
sc
>
99
||
eh
>
9
||
em
>
59
||
es
>
59
||
ec
>
99
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"Non-standard time reference %d:%d:%d.%d,%d:%d:%d.%d
\n
"
,
sh
,
sm
,
ss
,
sc
,
eh
,
em
,
es
,
ec
);
return
0
;
}
start
=
3600000
*
sh
+
60000
*
sm
+
1000
*
ss
+
10
*
sc
;
end
=
3600000
*
eh
+
60000
*
em
+
1000
*
es
+
10
*
ec
;
if
(
start
>
end
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"Unexpected time reference %d:%d:%d.%d,%d:%d:%d.%d
\n
"
,
sh
,
sm
,
ss
,
sc
,
eh
,
em
,
es
,
ec
);
return
0
;
}
return
end
-
start
;
}
...
...
@@ -1250,7 +1267,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb,
char
buffer
[
2048
];
while
(
data_size
)
{
int
duration
=
ass_get_duration
(
data
);
int
duration
=
ass_get_duration
(
s
,
data
);
max_duration
=
FFMAX
(
duration
,
max_duration
);
end
=
memchr
(
data
,
'\n'
,
data_size
);
size
=
line_size
=
end
?
end
-
data
+
1
:
data_size
;
...
...
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