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
309616b2
Commit
309616b2
authored
15 years ago
by
Ramiro Polla
Browse files
Options
Downloads
Patches
Plain Diff
mlpdec: Validate num_primitive_matrices.
Originally committed as revision 18650 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
868170c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavcodec/mlp.h
+2
-0
2 additions, 0 deletions
libavcodec/mlp.h
libavcodec/mlpdec.c
+10
-0
10 additions, 0 deletions
libavcodec/mlpdec.c
with
12 additions
and
0 deletions
libavcodec/mlp.h
+
2
−
0
View file @
309616b2
...
@@ -35,6 +35,8 @@
...
@@ -35,6 +35,8 @@
/** Maximum number of matrices used in decoding; most streams have one matrix
/** Maximum number of matrices used in decoding; most streams have one matrix
* per output channel, but some rematrix a channel (usually 0) more than once.
* per output channel, but some rematrix a channel (usually 0) more than once.
*/
*/
#define MAX_MATRICES_MLP 6
#define MAX_MATRICES_TRUEHD 8
#define MAX_MATRICES 15
#define MAX_MATRICES 15
/** Maximum number of substreams that can be decoded.
/** Maximum number of substreams that can be decoded.
...
...
This diff is collapsed.
Click to expand it.
libavcodec/mlpdec.c
+
10
−
0
View file @
309616b2
...
@@ -527,6 +527,9 @@ static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitCo
...
@@ -527,6 +527,9 @@ static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitCo
{
{
SubStream
*
s
=
&
m
->
substream
[
substr
];
SubStream
*
s
=
&
m
->
substream
[
substr
];
unsigned
int
mat
,
ch
;
unsigned
int
mat
,
ch
;
const
int
max_primitive_matrices
=
m
->
avctx
->
codec_id
==
CODEC_ID_MLP
?
MAX_MATRICES_MLP
:
MAX_MATRICES_TRUEHD
;
if
(
m
->
matrix_changed
++
>
1
)
{
if
(
m
->
matrix_changed
++
>
1
)
{
av_log
(
m
->
avctx
,
AV_LOG_ERROR
,
"Matrices may change only once per access unit.
\n
"
);
av_log
(
m
->
avctx
,
AV_LOG_ERROR
,
"Matrices may change only once per access unit.
\n
"
);
...
@@ -535,6 +538,13 @@ static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitCo
...
@@ -535,6 +538,13 @@ static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitCo
s
->
num_primitive_matrices
=
get_bits
(
gbp
,
4
);
s
->
num_primitive_matrices
=
get_bits
(
gbp
,
4
);
if
(
s
->
num_primitive_matrices
>
max_primitive_matrices
)
{
av_log
(
m
->
avctx
,
AV_LOG_ERROR
,
"Number of primitive matrices cannot be greater than %d.
\n
"
,
max_primitive_matrices
);
return
-
1
;
}
for
(
mat
=
0
;
mat
<
s
->
num_primitive_matrices
;
mat
++
)
{
for
(
mat
=
0
;
mat
<
s
->
num_primitive_matrices
;
mat
++
)
{
int
frac_bits
,
max_chan
;
int
frac_bits
,
max_chan
;
s
->
matrix_out_ch
[
mat
]
=
get_bits
(
gbp
,
4
);
s
->
matrix_out_ch
[
mat
]
=
get_bits
(
gbp
,
4
);
...
...
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