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
a1c525f7
Commit
a1c525f7
authored
Nov 17, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcx: return meaningful error codes.
parent
6bf70127
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
pcx.c
libavcodec/pcx.c
+8
-8
No files found.
libavcodec/pcx.c
View file @
a1c525f7
...
@@ -94,7 +94,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -94,7 +94,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if
(
buf
[
0
]
!=
0x0a
||
buf
[
1
]
>
5
)
{
if
(
buf
[
0
]
!=
0x0a
||
buf
[
1
]
>
5
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"this is not PCX encoded data
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"this is not PCX encoded data
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
compressed
=
buf
[
2
];
compressed
=
buf
[
2
];
...
@@ -105,7 +105,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -105,7 +105,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if
(
xmax
<
xmin
||
ymax
<
ymin
)
{
if
(
xmax
<
xmin
||
ymax
<
ymin
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid image dimensions
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid image dimensions
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
w
=
xmax
-
xmin
+
1
;
w
=
xmax
-
xmin
+
1
;
...
@@ -118,7 +118,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -118,7 +118,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if
(
bytes_per_scanline
<
w
*
bits_per_pixel
*
nplanes
/
8
)
{
if
(
bytes_per_scanline
<
w
*
bits_per_pixel
*
nplanes
/
8
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"PCX data is corrupted
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"PCX data is corrupted
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
switch
((
nplanes
<<
8
)
+
bits_per_pixel
)
{
switch
((
nplanes
<<
8
)
+
bits_per_pixel
)
{
...
@@ -136,7 +136,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -136,7 +136,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
break
;
break
;
default:
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid PCX file
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid PCX file
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
buf
+=
128
;
buf
+=
128
;
...
@@ -144,13 +144,13 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -144,13 +144,13 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if
(
p
->
data
[
0
])
if
(
p
->
data
[
0
])
avctx
->
release_buffer
(
avctx
,
p
);
avctx
->
release_buffer
(
avctx
,
p
);
if
(
av_image_check_size
(
w
,
h
,
0
,
avctx
)
)
if
(
(
ret
=
av_image_check_size
(
w
,
h
,
0
,
avctx
))
<
0
)
return
-
1
;
return
ret
;
if
(
w
!=
avctx
->
width
||
h
!=
avctx
->
height
)
if
(
w
!=
avctx
->
width
||
h
!=
avctx
->
height
)
avcodec_set_dimensions
(
avctx
,
w
,
h
);
avcodec_set_dimensions
(
avctx
,
w
,
h
);
if
(
ff_get_buffer
(
avctx
,
p
)
<
0
)
{
if
(
(
ret
=
ff_get_buffer
(
avctx
,
p
)
)
<
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
;
...
...
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