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
27a2f659
Commit
27a2f659
authored
Sep 04, 2019
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/vividas: Test size and packet numbers a bit more
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
8e51f35f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
vividas.c
libavformat/vividas.c
+19
-8
No files found.
libavformat/vividas.c
View file @
27a2f659
...
...
@@ -429,6 +429,7 @@ static int track_index(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *bu
int
maxnp
=
0
;
AVIOContext
*
pb
;
int
i
;
int64_t
filesize
=
avio_size
(
s
->
pb
);
pb
=
avio_alloc_context
(
buf
,
size
,
0
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
!
pb
)
...
...
@@ -437,11 +438,8 @@ static int track_index(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *bu
ffio_read_varlen
(
pb
);
// track_index_len
avio_r8
(
pb
);
// 'c'
viv
->
n_sb_blocks
=
ffio_read_varlen
(
pb
);
if
(
viv
->
n_sb_blocks
*
2
>
size
)
{
viv
->
n_sb_blocks
=
0
;
av_free
(
pb
);
return
AVERROR_INVALIDDATA
;
}
if
(
viv
->
n_sb_blocks
*
2
>
size
)
goto
error
;
viv
->
sb_blocks
=
av_calloc
(
viv
->
n_sb_blocks
,
sizeof
(
VIV_SB_block
));
if
(
!
viv
->
sb_blocks
)
{
viv
->
n_sb_blocks
=
0
;
...
...
@@ -453,24 +451,37 @@ static int track_index(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *bu
poff
=
0
;
for
(
i
=
0
;
i
<
viv
->
n_sb_blocks
;
i
++
)
{
uint64_t
size_tmp
=
ffio_read_varlen
(
pb
);
uint64_t
n_packets_tmp
=
ffio_read_varlen
(
pb
);
if
(
size_tmp
>
INT_MAX
||
n_packets_tmp
>
INT_MAX
)
goto
error
;
viv
->
sb_blocks
[
i
].
byte_offset
=
off
;
viv
->
sb_blocks
[
i
].
packet_offset
=
poff
;
viv
->
sb_blocks
[
i
].
size
=
ffio_read_varlen
(
pb
)
;
viv
->
sb_blocks
[
i
].
n_packets
=
ffio_read_varlen
(
pb
)
;
viv
->
sb_blocks
[
i
].
size
=
size_tmp
;
viv
->
sb_blocks
[
i
].
n_packets
=
n_packets_tmp
;
off
+=
viv
->
sb_blocks
[
i
].
size
;
poff
+=
viv
->
sb_blocks
[
i
].
n_packets
;
if
(
maxnp
<
viv
->
sb_blocks
[
i
].
n_packets
)
maxnp
=
viv
->
sb_blocks
[
i
].
n_packets
;
}
if
(
filesize
>
0
&&
poff
>
filesize
)
goto
error
;
viv
->
sb_entries
=
av_calloc
(
maxnp
,
sizeof
(
VIV_SB_entry
));
av_free
(
pb
);
return
0
;
error:
av_free
(
pb
);
viv
->
n_sb_blocks
=
0
;
av_freep
(
&
viv
->
sb_blocks
);
return
AVERROR_INVALIDDATA
;
}
static
void
load_sb_block
(
AVFormatContext
*
s
,
VividasDemuxContext
*
viv
,
unsigned
expected_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