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
9ea24296
Commit
9ea24296
authored
May 26, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
j2k: ff_j2k_tag_tree_init: check for integer overflow in alloc
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
b01e61a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
j2k.c
libavcodec/j2k.c
+11
-7
No files found.
libavcodec/j2k.c
View file @
9ea24296
...
...
@@ -55,7 +55,7 @@ Jpeg2000TgtNode *ff_j2k_tag_tree_init(int w, int h)
tt_size
=
tag_tree_size
(
w
,
h
);
t
=
res
=
av_mallocz
(
tt_size
,
sizeof
(
*
t
));
t
=
res
=
av_mallocz
_array
(
tt_size
,
sizeof
(
*
t
));
if
(
!
res
)
return
NULL
;
...
...
@@ -181,11 +181,10 @@ int ff_j2k_init_component(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty,
for
(
i
=
0
;
i
<
2
;
i
++
)
csize
*=
comp
->
coord
[
i
][
1
]
-
comp
->
coord
[
i
][
0
];
comp
->
data
=
av_malloc
(
csize
*
sizeof
(
int
));
comp
->
data
=
av_malloc
_array
(
csize
,
sizeof
(
int
));
if
(
!
comp
->
data
)
return
AVERROR
(
ENOMEM
);
comp
->
reslevel
=
av_malloc
(
codsty
->
nreslevels
*
sizeof
(
Jpeg2000ResLevel
));
comp
->
reslevel
=
av_malloc_array
(
codsty
->
nreslevels
,
sizeof
(
*
comp
->
reslevel
));
if
(
!
comp
->
reslevel
)
return
AVERROR
(
ENOMEM
);
for
(
reslevelno
=
0
;
reslevelno
<
codsty
->
nreslevels
;
reslevelno
++
)
{
...
...
@@ -214,9 +213,10 @@ int ff_j2k_init_component(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty,
reslevel
->
num_precincts_y
=
ff_jpeg2000_ceildivpow2
(
reslevel
->
coord
[
1
][
1
],
codsty
->
log2_prec_height
)
-
(
reslevel
->
coord
[
1
][
0
]
>>
codsty
->
log2_prec_height
);
reslevel
->
band
=
av_malloc
(
reslevel
->
nbands
*
sizeof
(
Jpeg2000B
and
));
reslevel
->
band
=
av_malloc
_array
(
reslevel
->
nbands
,
sizeof
(
*
reslevel
->
b
and
));
if
(
!
reslevel
->
band
)
return
AVERROR
(
ENOMEM
);
for
(
bandno
=
0
;
bandno
<
reslevel
->
nbands
;
bandno
++
,
gbandno
++
)
{
Jpeg2000Band
*
band
=
reslevel
->
band
+
bandno
;
int
cblkno
,
precx
,
precy
,
precno
;
...
...
@@ -258,10 +258,14 @@ int ff_j2k_init_component(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty,
band
->
cblknx
=
ff_jpeg2000_ceildiv
(
band
->
cblknx
,
dx
);
band
->
cblkny
=
ff_jpeg2000_ceildiv
(
band
->
cblkny
,
dy
);
band
->
cblk
=
av_malloc
(
sizeof
(
Jpeg2000Cblk
)
*
band
->
cblknx
*
band
->
cblkny
);
band
->
cblk
=
av_malloc_array
(
band
->
cblknx
*
band
->
cblkny
,
sizeof
(
*
band
->
cblk
));
if
(
!
band
->
cblk
)
return
AVERROR
(
ENOMEM
);
band
->
prec
=
av_malloc
(
sizeof
(
Jpeg2000Cblk
)
*
reslevel
->
num_precincts_x
*
reslevel
->
num_precincts_y
);
band
->
prec
=
av_malloc_array
(
reslevel
->
num_precincts_x
*
reslevel
->
num_precincts_y
,
sizeof
(
*
band
->
prec
));
if
(
!
band
->
prec
)
return
AVERROR
(
ENOMEM
);
...
...
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