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
02660a87
Commit
02660a87
authored
Sep 28, 2011
by
Laurent Aimar
Committed by
Michael Niedermayer
Sep 29, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for out of bound reads in jpeg 2000 decoder.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
41b7389c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
j2kdec.c
libavcodec/j2kdec.c
+6
-3
No files found.
libavcodec/j2kdec.c
View file @
02660a87
...
...
@@ -961,18 +961,20 @@ static int decode_codestream(J2kDecoderContext *s)
static
int
jp2_find_codestream
(
J2kDecoderContext
*
s
)
{
int32_t
atom_size
;
u
int32_t
atom_size
;
int
found_codestream
=
0
,
search_range
=
10
;
// skip jpeg2k signature atom
s
->
buf
+=
12
;
while
(
!
found_codestream
&&
search_range
)
{
while
(
!
found_codestream
&&
search_range
&&
s
->
buf_end
-
s
->
buf
>=
8
)
{
atom_size
=
AV_RB32
(
s
->
buf
);
if
(
AV_RB32
(
s
->
buf
+
4
)
==
JP2_CODESTREAM
)
{
found_codestream
=
1
;
s
->
buf
+=
8
;
}
else
{
if
(
s
->
buf_end
-
s
->
buf
<
atom_size
)
return
0
;
s
->
buf
+=
atom_size
;
search_range
--
;
}
...
...
@@ -1005,7 +1007,8 @@ static int decode_frame(AVCodecContext *avctx,
return
AVERROR
(
EINVAL
);
// check if the image is in jp2 format
if
((
AV_RB32
(
s
->
buf
)
==
12
)
&&
(
AV_RB32
(
s
->
buf
+
4
)
==
JP2_SIG_TYPE
)
&&
if
(
s
->
buf_end
-
s
->
buf
>=
12
&&
(
AV_RB32
(
s
->
buf
)
==
12
)
&&
(
AV_RB32
(
s
->
buf
+
4
)
==
JP2_SIG_TYPE
)
&&
(
AV_RB32
(
s
->
buf
+
8
)
==
JP2_SIG_VALUE
))
{
if
(
!
jp2_find_codestream
(
s
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"couldn't find jpeg2k codestream atom
\n
"
);
...
...
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