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
742a26c4
Commit
742a26c4
authored
Jun 14, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/jpeg2000dec: Print error messages for more error conditions
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
ed0b1db6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
jpeg2000dec.c
libavcodec/jpeg2000dec.c
+21
-7
No files found.
libavcodec/jpeg2000dec.c
View file @
742a26c4
...
@@ -133,8 +133,10 @@ static int tag_tree_decode(Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node,
...
@@ -133,8 +133,10 @@ static int tag_tree_decode(Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node,
Jpeg2000TgtNode
*
stack
[
30
];
Jpeg2000TgtNode
*
stack
[
30
];
int
sp
=
-
1
,
curval
=
0
;
int
sp
=
-
1
,
curval
=
0
;
if
(
!
node
)
if
(
!
node
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"missing node
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
while
(
node
&&
!
node
->
vis
)
{
while
(
node
&&
!
node
->
vis
)
{
stack
[
++
sp
]
=
node
;
stack
[
++
sp
]
=
node
;
...
@@ -237,8 +239,10 @@ static int get_siz(Jpeg2000DecoderContext *s)
...
@@ -237,8 +239,10 @@ static int get_siz(Jpeg2000DecoderContext *s)
const
enum
AVPixelFormat
*
possible_fmts
=
NULL
;
const
enum
AVPixelFormat
*
possible_fmts
=
NULL
;
int
possible_fmts_nb
=
0
;
int
possible_fmts_nb
=
0
;
if
(
bytestream2_get_bytes_left
(
&
s
->
g
)
<
36
)
if
(
bytestream2_get_bytes_left
(
&
s
->
g
)
<
36
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Insufficient space for SIZ
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
s
->
avctx
->
profile
=
bytestream2_get_be16u
(
&
s
->
g
);
// Rsiz
s
->
avctx
->
profile
=
bytestream2_get_be16u
(
&
s
->
g
);
// Rsiz
s
->
width
=
bytestream2_get_be32u
(
&
s
->
g
);
// Width
s
->
width
=
bytestream2_get_be32u
(
&
s
->
g
);
// Width
...
@@ -276,8 +280,10 @@ static int get_siz(Jpeg2000DecoderContext *s)
...
@@ -276,8 +280,10 @@ static int get_siz(Jpeg2000DecoderContext *s)
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
if
(
bytestream2_get_bytes_left
(
&
s
->
g
)
<
3
*
s
->
ncomponents
)
if
(
bytestream2_get_bytes_left
(
&
s
->
g
)
<
3
*
s
->
ncomponents
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Insufficient space for %d components in SIZ
\n
"
,
s
->
ncomponents
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
for
(
i
=
0
;
i
<
s
->
ncomponents
;
i
++
)
{
// Ssiz_i XRsiz_i, YRsiz_i
for
(
i
=
0
;
i
<
s
->
ncomponents
;
i
++
)
{
// Ssiz_i XRsiz_i, YRsiz_i
uint8_t
x
=
bytestream2_get_byteu
(
&
s
->
g
);
uint8_t
x
=
bytestream2_get_byteu
(
&
s
->
g
);
...
@@ -398,8 +404,10 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
...
@@ -398,8 +404,10 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)
{
{
uint8_t
byte
;
uint8_t
byte
;
if
(
bytestream2_get_bytes_left
(
&
s
->
g
)
<
5
)
if
(
bytestream2_get_bytes_left
(
&
s
->
g
)
<
5
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Insufficient space for COX
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
/* nreslevels = number of resolution levels
/* nreslevels = number of resolution levels
= number of decomposition level +1 */
= number of decomposition level +1 */
...
@@ -468,8 +476,10 @@ static int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
...
@@ -468,8 +476,10 @@ static int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
Jpeg2000CodingStyle
tmp
;
Jpeg2000CodingStyle
tmp
;
int
compno
,
ret
;
int
compno
,
ret
;
if
(
bytestream2_get_bytes_left
(
&
s
->
g
)
<
5
)
if
(
bytestream2_get_bytes_left
(
&
s
->
g
)
<
5
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Insufficient space for COD
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
tmp
.
csty
=
bytestream2_get_byteu
(
&
s
->
g
);
tmp
.
csty
=
bytestream2_get_byteu
(
&
s
->
g
);
...
@@ -502,8 +512,10 @@ static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
...
@@ -502,8 +512,10 @@ static int get_coc(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c,
{
{
int
compno
,
ret
;
int
compno
,
ret
;
if
(
bytestream2_get_bytes_left
(
&
s
->
g
)
<
2
)
if
(
bytestream2_get_bytes_left
(
&
s
->
g
)
<
2
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Insufficient space for COC
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
compno
=
bytestream2_get_byteu
(
&
s
->
g
);
compno
=
bytestream2_get_byteu
(
&
s
->
g
);
...
@@ -1700,8 +1712,10 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
...
@@ -1700,8 +1712,10 @@ static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
break
;
break
;
len
=
bytestream2_get_be16
(
&
s
->
g
);
len
=
bytestream2_get_be16
(
&
s
->
g
);
if
(
len
<
2
||
bytestream2_get_bytes_left
(
&
s
->
g
)
<
len
-
2
)
if
(
len
<
2
||
bytestream2_get_bytes_left
(
&
s
->
g
)
<
len
-
2
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid len %d left=%d
\n
"
,
len
,
bytestream2_get_bytes_left
(
&
s
->
g
));
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
switch
(
marker
)
{
switch
(
marker
)
{
case
JPEG2000_SIZ
:
case
JPEG2000_SIZ
:
...
...
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