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
55354b7d
Commit
55354b7d
authored
Sep 07, 2011
by
Laurent Aimar
Committed by
Martin Storsjö
Sep 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed invalid access in wavpack decoder on corrupted bitstream.
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
0aedab03
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
14 deletions
+35
-14
wavpack.c
libavcodec/wavpack.c
+35
-14
No files found.
libavcodec/wavpack.c
View file @
55354b7d
...
@@ -292,7 +292,14 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel
...
@@ -292,7 +292,14 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel
}
}
}
else
{
}
else
{
t
=
get_unary_0_33
(
gb
);
t
=
get_unary_0_33
(
gb
);
if
(
t
>=
2
)
t
=
get_bits
(
gb
,
t
-
1
)
|
(
1
<<
(
t
-
1
));
if
(
t
>=
2
){
if
(
get_bits_left
(
gb
)
<
t
-
1
)
goto
error
;
t
=
get_bits
(
gb
,
t
-
1
)
|
(
1
<<
(
t
-
1
));
}
else
{
if
(
get_bits_left
(
gb
)
<
0
)
goto
error
;
}
ctx
->
zeroes
=
t
;
ctx
->
zeroes
=
t
;
if
(
ctx
->
zeroes
){
if
(
ctx
->
zeroes
){
memset
(
ctx
->
ch
[
0
].
median
,
0
,
sizeof
(
ctx
->
ch
[
0
].
median
));
memset
(
ctx
->
ch
[
0
].
median
,
0
,
sizeof
(
ctx
->
ch
[
0
].
median
));
...
@@ -303,24 +310,24 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel
...
@@ -303,24 +310,24 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel
}
}
}
}
if
(
get_bits_count
(
gb
)
>=
ctx
->
data_size
){
*
last
=
1
;
return
0
;
}
if
(
ctx
->
zero
){
if
(
ctx
->
zero
){
t
=
0
;
t
=
0
;
ctx
->
zero
=
0
;
ctx
->
zero
=
0
;
}
else
{
}
else
{
t
=
get_unary_0_33
(
gb
);
t
=
get_unary_0_33
(
gb
);
if
(
get_bits_count
(
gb
)
>=
ctx
->
data_size
){
if
(
get_bits_left
(
gb
)
<
0
)
*
last
=
1
;
goto
error
;
return
0
;
}
if
(
t
==
16
)
{
if
(
t
==
16
)
{
t2
=
get_unary_0_33
(
gb
);
t2
=
get_unary_0_33
(
gb
);
if
(
t2
<
2
)
t
+=
t2
;
if
(
t2
<
2
){
else
t
+=
get_bits
(
gb
,
t2
-
1
)
|
(
1
<<
(
t2
-
1
));
if
(
get_bits_left
(
gb
)
<
0
)
goto
error
;
t
+=
t2
;
}
else
{
if
(
get_bits_left
(
gb
)
<
t2
-
1
)
goto
error
;
t
+=
get_bits
(
gb
,
t2
-
1
)
|
(
1
<<
(
t2
-
1
));
}
}
}
if
(
ctx
->
one
){
if
(
ctx
->
one
){
...
@@ -360,9 +367,13 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel
...
@@ -360,9 +367,13 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel
}
}
if
(
!
c
->
error_limit
){
if
(
!
c
->
error_limit
){
ret
=
base
+
get_tail
(
gb
,
add
);
ret
=
base
+
get_tail
(
gb
,
add
);
if
(
get_bits_left
(
gb
)
<=
0
)
goto
error
;
}
else
{
}
else
{
int
mid
=
(
base
*
2
+
add
+
1
)
>>
1
;
int
mid
=
(
base
*
2
+
add
+
1
)
>>
1
;
while
(
add
>
c
->
error_limit
){
while
(
add
>
c
->
error_limit
){
if
(
get_bits_left
(
gb
)
<=
0
)
goto
error
;
if
(
get_bits1
(
gb
)){
if
(
get_bits1
(
gb
)){
add
-=
(
mid
-
base
);
add
-=
(
mid
-
base
);
base
=
mid
;
base
=
mid
;
...
@@ -376,6 +387,10 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel
...
@@ -376,6 +387,10 @@ static int wv_get_value(WavpackFrameContext *ctx, GetBitContext *gb, int channel
if
(
ctx
->
hybrid_bitrate
)
if
(
ctx
->
hybrid_bitrate
)
c
->
slow_level
+=
wp_log2
(
ret
)
-
LEVEL_DECAY
(
c
->
slow_level
);
c
->
slow_level
+=
wp_log2
(
ret
)
-
LEVEL_DECAY
(
c
->
slow_level
);
return
sign
?
~
ret
:
ret
;
return
sign
?
~
ret
:
ret
;
error:
*
last
=
1
;
return
0
;
}
}
static
inline
int
wv_get_value_integer
(
WavpackFrameContext
*
s
,
uint32_t
*
crc
,
int
S
)
static
inline
int
wv_get_value_integer
(
WavpackFrameContext
*
s
,
uint32_t
*
crc
,
int
S
)
...
@@ -581,6 +596,9 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, vo
...
@@ -581,6 +596,9 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, vo
count
++
;
count
++
;
}
while
(
!
last
&&
count
<
s
->
max_samples
);
}
while
(
!
last
&&
count
<
s
->
max_samples
);
if
(
last
)
s
->
samples_left
=
0
;
else
s
->
samples_left
-=
count
;
s
->
samples_left
-=
count
;
if
(
!
s
->
samples_left
){
if
(
!
s
->
samples_left
){
wv_reset_saved_context
(
s
);
wv_reset_saved_context
(
s
);
...
@@ -659,6 +677,9 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, void
...
@@ -659,6 +677,9 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, void
count
++
;
count
++
;
}
while
(
!
last
&&
count
<
s
->
max_samples
);
}
while
(
!
last
&&
count
<
s
->
max_samples
);
if
(
last
)
s
->
samples_left
=
0
;
else
s
->
samples_left
-=
count
;
s
->
samples_left
-=
count
;
if
(
!
s
->
samples_left
){
if
(
!
s
->
samples_left
){
wv_reset_saved_context
(
s
);
wv_reset_saved_context
(
s
);
...
...
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