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
bceabbda
Commit
bceabbda
authored
Nov 22, 2014
by
Lukasz Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/libvorbisdec: fix mem leak in case of init failure
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki2@gmail.com
>
parent
96938216
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
libvorbisdec.c
libavcodec/libvorbisdec.c
+15
-7
No files found.
libavcodec/libvorbisdec.c
View file @
bceabbda
...
...
@@ -35,17 +35,17 @@ typedef struct OggVorbisDecContext {
static
int
oggvorbis_decode_init
(
AVCodecContext
*
avccontext
)
{
OggVorbisDecContext
*
context
=
avccontext
->
priv_data
;
uint8_t
*
p
=
avccontext
->
extradata
;
int
i
,
hsizes
[
3
];
int
i
,
hsizes
[
3
]
,
ret
;
unsigned
char
*
headers
[
3
],
*
extradata
=
avccontext
->
extradata
;
vorbis_info_init
(
&
context
->
vi
)
;
vorbis_comment_init
(
&
context
->
vc
)
;
if
(
!
avccontext
->
extradata_size
||
!
p
)
{
av_log
(
avccontext
,
AV_LOG_ERROR
,
"vorbis extradata absent
\n
"
);
return
-
1
;
}
vorbis_info_init
(
&
context
->
vi
)
;
vorbis_comment_init
(
&
context
->
vc
)
;
if
(
p
[
0
]
==
0
&&
p
[
1
]
==
30
)
{
for
(
i
=
0
;
i
<
3
;
i
++
){
hsizes
[
i
]
=
bytestream_get_be16
((
const
uint8_t
**
)
&
p
);
...
...
@@ -65,7 +65,8 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) {
if
(
offset
>=
avccontext
->
extradata_size
-
1
)
{
av_log
(
avccontext
,
AV_LOG_ERROR
,
"vorbis header sizes damaged
\n
"
);
return
-
1
;
ret
=
-
1
;
goto
error
;
}
hsizes
[
i
]
+=
*
p
;
offset
++
;
...
...
@@ -83,7 +84,8 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) {
}
else
{
av_log
(
avccontext
,
AV_LOG_ERROR
,
"vorbis initial header len is wrong: %d
\n
"
,
*
p
);
return
-
1
;
ret
=
-
1
;
goto
error
;
}
for
(
i
=
0
;
i
<
3
;
i
++
){
...
...
@@ -92,7 +94,8 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) {
context
->
op
.
packet
=
headers
[
i
];
if
(
vorbis_synthesis_headerin
(
&
context
->
vi
,
&
context
->
vc
,
&
context
->
op
)
<
0
){
av_log
(
avccontext
,
AV_LOG_ERROR
,
"%d. vorbis header damaged
\n
"
,
i
+
1
);
return
-
1
;
ret
=
-
1
;
goto
error
;
}
}
...
...
@@ -105,6 +108,11 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) {
vorbis_block_init
(
&
context
->
vd
,
&
context
->
vb
);
return
0
;
error:
vorbis_info_clear
(
&
context
->
vi
);
vorbis_comment_clear
(
&
context
->
vc
)
;
return
ret
;
}
...
...
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