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
75007813
Commit
75007813
authored
Oct 11, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apedec: check for filter buffer allocation failure
parent
b9d6b027
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
+18
-13
apedec.c
libavcodec/apedec.c
+18
-13
No files found.
libavcodec/apedec.c
View file @
75007813
...
...
@@ -163,6 +163,18 @@ typedef struct APEContext {
// TODO: dsputilize
static
av_cold
int
ape_decode_close
(
AVCodecContext
*
avctx
)
{
APEContext
*
s
=
avctx
->
priv_data
;
int
i
;
for
(
i
=
0
;
i
<
APE_FILTER_LEVELS
;
i
++
)
av_freep
(
&
s
->
filterbuf
[
i
]);
av_freep
(
&
s
->
data
);
return
0
;
}
static
av_cold
int
ape_decode_init
(
AVCodecContext
*
avctx
)
{
APEContext
*
s
=
avctx
->
priv_data
;
...
...
@@ -195,25 +207,18 @@ static av_cold int ape_decode_init(AVCodecContext * avctx)
for
(
i
=
0
;
i
<
APE_FILTER_LEVELS
;
i
++
)
{
if
(
!
ape_filter_orders
[
s
->
fset
][
i
])
break
;
s
->
filterbuf
[
i
]
=
av_malloc
((
ape_filter_orders
[
s
->
fset
][
i
]
*
3
+
HISTORY_SIZE
)
*
4
);
FF_ALLOC_OR_GOTO
(
avctx
,
s
->
filterbuf
[
i
],
(
ape_filter_orders
[
s
->
fset
][
i
]
*
3
+
HISTORY_SIZE
)
*
4
,
filter_alloc_fail
);
}
dsputil_init
(
&
s
->
dsp
,
avctx
);
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
avctx
->
channel_layout
=
(
avctx
->
channels
==
2
)
?
AV_CH_LAYOUT_STEREO
:
AV_CH_LAYOUT_MONO
;
return
0
;
}
static
av_cold
int
ape_decode_close
(
AVCodecContext
*
avctx
)
{
APEContext
*
s
=
avctx
->
priv_data
;
int
i
;
for
(
i
=
0
;
i
<
APE_FILTER_LEVELS
;
i
++
)
av_freep
(
&
s
->
filterbuf
[
i
]);
av_freep
(
&
s
->
data
);
return
0
;
filter_alloc_fail:
ape_decode_close
(
avctx
);
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