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
99cb833f
Commit
99cb833f
authored
Nov 23, 2015
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sgi: Correctly propagate meaningful error values
parent
823fa700
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
sgidec.c
libavcodec/sgidec.c
+6
-5
sgienc.c
libavcodec/sgienc.c
+2
-2
No files found.
libavcodec/sgidec.c
View file @
99cb833f
...
@@ -229,13 +229,13 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -229,13 +229,13 @@ static int decode_frame(AVCodecContext *avctx,
if
(
s
->
bytes_per_channel
!=
1
&&
s
->
bytes_per_channel
!=
2
)
{
if
(
s
->
bytes_per_channel
!=
1
&&
s
->
bytes_per_channel
!=
2
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"wrong channel number
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"wrong channel number
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
/* Check for supported image dimensions. */
/* Check for supported image dimensions. */
if
(
dimension
!=
2
&&
dimension
!=
3
)
{
if
(
dimension
!=
2
&&
dimension
!=
3
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"wrong dimension number
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"wrong dimension number
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
if
(
s
->
depth
==
SGI_GRAYSCALE
)
{
if
(
s
->
depth
==
SGI_GRAYSCALE
)
{
...
@@ -246,16 +246,17 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -246,16 +246,17 @@ static int decode_frame(AVCodecContext *avctx,
avctx
->
pix_fmt
=
s
->
bytes_per_channel
==
2
?
AV_PIX_FMT_RGBA64BE
:
AV_PIX_FMT_RGBA
;
avctx
->
pix_fmt
=
s
->
bytes_per_channel
==
2
?
AV_PIX_FMT_RGBA64BE
:
AV_PIX_FMT_RGBA
;
}
else
{
}
else
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"wrong picture format
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"wrong picture format
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
ret
=
ff_set_dimensions
(
avctx
,
s
->
width
,
s
->
height
);
ret
=
ff_set_dimensions
(
avctx
,
s
->
width
,
s
->
height
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
if
(
ff_get_buffer
(
avctx
,
p
,
0
)
<
0
)
{
ret
=
ff_get_buffer
(
avctx
,
p
,
0
);
if
(
ret
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed.
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed.
\n
"
);
return
-
1
;
return
ret
;
}
}
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
...
...
libavcodec/sgienc.c
View file @
99cb833f
...
@@ -193,7 +193,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
...
@@ -193,7 +193,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
/* Make an intermediate consecutive buffer. */
/* Make an intermediate consecutive buffer. */
if
(
!
(
encode_buf
=
av_malloc
(
width
*
bytes_per_channel
)))
if
(
!
(
encode_buf
=
av_malloc
(
width
*
bytes_per_channel
)))
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
for
(
z
=
0
;
z
<
depth
;
z
++
)
{
for
(
z
=
0
;
z
<
depth
;
z
++
)
{
in_buf
=
p
->
data
[
0
]
+
p
->
linesize
[
0
]
*
(
height
-
1
)
+
z
*
bytes_per_channel
;
in_buf
=
p
->
data
[
0
]
+
p
->
linesize
[
0
]
*
(
height
-
1
)
+
z
*
bytes_per_channel
;
...
@@ -208,7 +208,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
...
@@ -208,7 +208,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
bytes_per_channel
);
bytes_per_channel
);
if
(
length
<
1
)
{
if
(
length
<
1
)
{
av_free
(
encode_buf
);
av_free
(
encode_buf
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
bytestream2_put_be32
(
&
tablen_pcb
,
length
);
bytestream2_put_be32
(
&
tablen_pcb
,
length
);
...
...
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