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
2b790b1c
Commit
2b790b1c
authored
Mar 12, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/xpmdec: do not allow number of colors to be higher than allocated
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
fbc1f323
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
xpmdec.c
libavcodec/xpmdec.c
+8
-15
No files found.
libavcodec/xpmdec.c
View file @
2b790b1c
...
...
@@ -328,29 +328,22 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data,
if
((
ret
=
ff_get_buffer
(
avctx
,
p
,
0
))
<
0
)
return
ret
;
if
(
ncolors
<=
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"
invalid number of colors: %d
\n
"
,
ncolors
);
if
(
cpp
<=
0
||
cpp
>=
5
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"
unsupported/invalid number of chars per pixel: %d
\n
"
,
cpp
);
return
AVERROR_INVALIDDATA
;
}
if
(
cpp
<=
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid number of chars per pixel: %d
\n
"
,
cpp
);
size
=
1
;
for
(
i
=
0
;
i
<
cpp
;
i
++
)
size
*=
94
;
if
(
ncolors
<=
0
||
ncolors
>
size
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid number of colors: %d
\n
"
,
ncolors
);
return
AVERROR_INVALIDDATA
;
}
size
=
1
;
j
=
1
;
for
(
i
=
0
;
i
<
cpp
;
i
++
)
{
size
+=
j
*
94
;
j
*=
95
;
}
size
*=
4
;
if
(
size
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"unsupported number of chars per pixel: %d
\n
"
,
cpp
);
return
AVERROR
(
ENOMEM
);
}
av_fast_padded_malloc
(
&
x
->
pixels
,
&
x
->
pixels_size
,
size
);
if
(
!
x
->
pixels
)
return
AVERROR
(
ENOMEM
);
...
...
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