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
b44a55ad
Commit
b44a55ad
authored
May 19, 2015
by
Niklesh
Committed by
Philip Langdale
May 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix movtext crashes caused due to lack of proper bounds checking
Signed-off-by:
Niklesh
<
niklesh.lalwani@iitb.ac.in
>
parent
b8e7f2b2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
movtextdec.c
libavcodec/movtextdec.c
+15
-3
No files found.
libavcodec/movtextdec.c
View file @
b44a55ad
...
...
@@ -96,7 +96,7 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
char
*
ptr
=
avpkt
->
data
;
char
*
end
;
//char *ptr_temp;
int
text_length
,
tsmb_type
,
style_entries
,
tsmb_size
;
int
text_length
,
tsmb_type
,
style_entries
,
tsmb_size
,
tracksize
;
int
**
style_start
=
{
0
,};
int
**
style_end
=
{
0
,};
int
**
style_flags
=
{
0
,};
...
...
@@ -135,20 +135,31 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
(
AVRational
){
1
,
100
});
tsmb_size
=
0
;
tracksize
=
2
+
text_length
;
// Note that the spec recommends lines be no longer than 2048 characters.
av_bprint_init
(
&
buf
,
0
,
AV_BPRINT_SIZE_UNLIMITED
);
if
(
text_length
+
2
!=
avpkt
->
size
)
{
while
(
text_length
+
2
+
tsmb_size
<
avpkt
->
size
)
{
tsmb
=
ptr
+
text_length
+
tsmb_size
;
while
(
tracksize
+
8
<=
avpkt
->
size
)
{
// A box is a minimum of 8 bytes.
tsmb
=
ptr
+
tracksize
-
2
;
tsmb_size
=
AV_RB32
(
tsmb
);
tsmb
+=
4
;
tsmb_type
=
AV_RB32
(
tsmb
);
tsmb
+=
4
;
if
(
tracksize
+
tsmb_size
>
avpkt
->
size
)
break
;
if
(
tsmb_type
==
MKBETAG
(
's'
,
't'
,
'y'
,
'l'
))
{
if
(
tracksize
+
10
>
avpkt
->
size
)
break
;
style_entries
=
AV_RB16
(
tsmb
);
tsmb
+=
2
;
// A single style record is of length 12 bytes.
if
(
tracksize
+
10
+
style_entries
*
12
>
avpkt
->
size
)
break
;
for
(
i
=
0
;
i
<
style_entries
;
i
++
)
{
style_pos
=
av_malloc
(
4
);
*
style_pos
=
AV_RB16
(
tsmb
);
...
...
@@ -176,6 +187,7 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
av_freep
(
&
style_end
);
av_freep
(
&
style_flags
);
}
tracksize
=
tracksize
+
tsmb_size
;
}
}
else
text_to_ass
(
&
buf
,
ptr
,
end
,
NULL
,
NULL
,
0
,
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