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
eeb792d8
Commit
eeb792d8
authored
Mar 20, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pngdec: Print error messages for the various failure pathes.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
9dd649c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
pngdec.c
libavcodec/pngdec.c
+13
-4
No files found.
libavcodec/pngdec.c
View file @
eeb792d8
...
@@ -416,12 +416,16 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -416,12 +416,16 @@ static int decode_frame(AVCodecContext *avctx,
if
(
ret
!=
Z_OK
)
if
(
ret
!=
Z_OK
)
return
-
1
;
return
-
1
;
for
(;;)
{
for
(;;)
{
if
(
bytestream2_get_bytes_left
(
&
s
->
gb
)
<=
0
)
if
(
bytestream2_get_bytes_left
(
&
s
->
gb
)
<=
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"No bytes left
\n
"
);
goto
fail
;
goto
fail
;
}
length
=
bytestream2_get_be32
(
&
s
->
gb
);
length
=
bytestream2_get_be32
(
&
s
->
gb
);
if
(
length
>
0x7fffffff
||
length
>
bytestream2_get_bytes_left
(
&
s
->
gb
))
if
(
length
>
0x7fffffff
||
length
>
bytestream2_get_bytes_left
(
&
s
->
gb
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"chunk too big
\n
"
);
goto
fail
;
goto
fail
;
}
tag
=
bytestream2_get_le32
(
&
s
->
gb
);
tag
=
bytestream2_get_le32
(
&
s
->
gb
);
if
(
avctx
->
debug
&
FF_DEBUG_STARTCODE
)
if
(
avctx
->
debug
&
FF_DEBUG_STARTCODE
)
av_log
(
avctx
,
AV_LOG_DEBUG
,
"png: tag=%c%c%c%c length=%u
\n
"
,
av_log
(
avctx
,
AV_LOG_DEBUG
,
"png: tag=%c%c%c%c length=%u
\n
"
,
...
@@ -437,6 +441,7 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -437,6 +441,7 @@ static int decode_frame(AVCodecContext *avctx,
s
->
height
=
bytestream2_get_be32
(
&
s
->
gb
);
s
->
height
=
bytestream2_get_be32
(
&
s
->
gb
);
if
(
av_image_check_size
(
s
->
width
,
s
->
height
,
0
,
avctx
)){
if
(
av_image_check_size
(
s
->
width
,
s
->
height
,
0
,
avctx
)){
s
->
width
=
s
->
height
=
0
;
s
->
width
=
s
->
height
=
0
;
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid image size
\n
"
);
goto
fail
;
goto
fail
;
}
}
s
->
bit_depth
=
bytestream2_get_byte
(
&
s
->
gb
);
s
->
bit_depth
=
bytestream2_get_byte
(
&
s
->
gb
);
...
@@ -452,8 +457,10 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -452,8 +457,10 @@ static int decode_frame(AVCodecContext *avctx,
s
->
compression_type
,
s
->
filter_type
,
s
->
interlace_type
);
s
->
compression_type
,
s
->
filter_type
,
s
->
interlace_type
);
break
;
break
;
case
MKTAG
(
'I'
,
'D'
,
'A'
,
'T'
)
:
case
MKTAG
(
'I'
,
'D'
,
'A'
,
'T'
)
:
if
(
!
(
s
->
state
&
PNG_IHDR
))
if
(
!
(
s
->
state
&
PNG_IHDR
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"IDAT without IHDR
\n
"
);
goto
fail
;
goto
fail
;
}
if
(
!
(
s
->
state
&
PNG_IDAT
))
{
if
(
!
(
s
->
state
&
PNG_IDAT
))
{
/* init image info */
/* init image info */
avctx
->
width
=
s
->
width
;
avctx
->
width
=
s
->
width
;
...
@@ -587,8 +594,10 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -587,8 +594,10 @@ static int decode_frame(AVCodecContext *avctx,
}
}
break
;
break
;
case
MKTAG
(
'I'
,
'E'
,
'N'
,
'D'
)
:
case
MKTAG
(
'I'
,
'E'
,
'N'
,
'D'
)
:
if
(
!
(
s
->
state
&
PNG_ALLIMAGE
))
if
(
!
(
s
->
state
&
PNG_ALLIMAGE
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"IEND without all image
\n
"
);
goto
fail
;
goto
fail
;
}
bytestream2_skip
(
&
s
->
gb
,
4
);
/* crc */
bytestream2_skip
(
&
s
->
gb
,
4
);
/* crc */
goto
exit_loop
;
goto
exit_loop
;
default
:
default
:
...
...
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