Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
596b5c48
Commit
596b5c48
authored
10 years ago
by
Vittorio Giovara
Browse files
Options
Downloads
Patches
Plain Diff
wma: check memory allocations and propagate errors
parent
63be97ec
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/wma.c
+19
-9
19 additions, 9 deletions
libavcodec/wma.c
with
19 additions
and
9 deletions
libavcodec/wma.c
+
19
−
9
View file @
596b5c48
...
...
@@ -33,9 +33,9 @@
/* XXX: use same run/length optimization as mpeg decoders */
// FIXME maybe split decode / encode or pass flag
static
av_cold
void
init_coef_vlc
(
VLC
*
vlc
,
uint16_t
**
prun_table
,
float
**
plevel_table
,
uint16_t
**
pint_table
,
const
CoefVLCTable
*
vlc_table
)
static
av_cold
int
init_coef_vlc
(
VLC
*
vlc
,
uint16_t
**
prun_table
,
float
**
plevel_table
,
uint16_t
**
pint_table
,
const
CoefVLCTable
*
vlc_table
)
{
int
n
=
vlc_table
->
n
;
const
uint8_t
*
table_bits
=
vlc_table
->
huffbits
;
...
...
@@ -51,6 +51,13 @@ static av_cold void init_coef_vlc(VLC *vlc, uint16_t **prun_table,
level_table
=
av_malloc
(
n
*
sizeof
(
uint16_t
));
flevel_table
=
av_malloc
(
n
*
sizeof
(
*
flevel_table
));
int_table
=
av_malloc
(
n
*
sizeof
(
uint16_t
));
if
(
!
run_table
||
!
level_table
||
!
flevel_table
||
!
int_table
)
{
av_freep
(
&
run_table
);
av_freep
(
&
level_table
);
av_freep
(
&
flevel_table
);
av_freep
(
&
int_table
);
return
AVERROR
(
ENOMEM
);
}
i
=
2
;
level
=
1
;
k
=
0
;
...
...
@@ -69,12 +76,14 @@ static av_cold void init_coef_vlc(VLC *vlc, uint16_t **prun_table,
*
plevel_table
=
flevel_table
;
*
pint_table
=
int_table
;
av_free
(
level_table
);
return
0
;
}
av_cold
int
ff_wma_init
(
AVCodecContext
*
avctx
,
int
flags2
)
{
WMACodecContext
*
s
=
avctx
->
priv_data
;
int
i
;
int
i
,
ret
;
float
bps1
,
high_freq
;
volatile
float
bps
;
int
sample_rate1
;
...
...
@@ -339,12 +348,13 @@ av_cold int ff_wma_init(AVCodecContext *avctx, int flags2)
}
s
->
coef_vlcs
[
0
]
=
&
coef_vlcs
[
coef_vlc_table
*
2
];
s
->
coef_vlcs
[
1
]
=
&
coef_vlcs
[
coef_vlc_table
*
2
+
1
];
init_coef_vlc
(
&
s
->
coef_vlc
[
0
],
&
s
->
run_table
[
0
],
&
s
->
level_table
[
0
],
&
s
->
int_table
[
0
],
s
->
coef_vlcs
[
0
]);
i
nit_coef_vlc
(
&
s
->
coef_vlc
[
1
],
&
s
->
run_table
[
1
],
&
s
->
level_table
[
1
],
&
s
->
int_table
[
1
],
s
->
coef_vlcs
[
1
])
;
ret
=
init_coef_vlc
(
&
s
->
coef_vlc
[
0
],
&
s
->
run_table
[
0
],
&
s
->
level_table
[
0
],
&
s
->
int_table
[
0
],
s
->
coef_vlcs
[
0
]);
i
f
(
ret
<
0
)
return
ret
;
return
0
;
return
init_coef_vlc
(
&
s
->
coef_vlc
[
1
],
&
s
->
run_table
[
1
],
&
s
->
level_table
[
1
],
&
s
->
int_table
[
1
],
s
->
coef_vlcs
[
1
]);
}
int
ff_wma_total_gain_to_bits
(
int
total_gain
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment