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
0b86ea03
Commit
0b86ea03
authored
Mar 30, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/ac3: fix out of array access introduced previously
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
91bb8713
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
ac3.h
libavcodec/ac3.h
+1
-0
ac3dec.c
libavcodec/ac3dec.c
+5
-5
ac3dec.h
libavcodec/ac3dec.h
+3
-3
No files found.
libavcodec/ac3.h
View file @
0b86ea03
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#define AVCODEC_AC3_H
#define AVCODEC_AC3_H
#define AC3_MAX_CODED_FRAME_SIZE 3840
/* in bytes */
#define AC3_MAX_CODED_FRAME_SIZE 3840
/* in bytes */
#define EAC3_MAX_CHANNELS 16
/**< maximum number of channels in EAC3 */
#define AC3_MAX_CHANNELS 7
/**< maximum number of channels, including coupling channel */
#define AC3_MAX_CHANNELS 7
/**< maximum number of channels, including coupling channel */
#define CPL_CH 0
/**< coupling channel index */
#define CPL_CH 0
/**< coupling channel index */
...
...
libavcodec/ac3dec.c
View file @
0b86ea03
...
@@ -1488,7 +1488,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
...
@@ -1488,7 +1488,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
int
blk
,
ch
,
err
,
offset
,
ret
;
int
blk
,
ch
,
err
,
offset
,
ret
;
int
got_independent_frame
=
0
;
int
got_independent_frame
=
0
;
const
uint8_t
*
channel_map
;
const
uint8_t
*
channel_map
;
uint8_t
extended_channel_map
[
AC3_MAX_CHANNELS
*
2
];
uint8_t
extended_channel_map
[
EAC3_MAX_CHANNELS
];
const
SHORTFLOAT
*
output
[
AC3_MAX_CHANNELS
];
const
SHORTFLOAT
*
output
[
AC3_MAX_CHANNELS
];
enum
AVMatrixEncoding
matrix_encoding
;
enum
AVMatrixEncoding
matrix_encoding
;
AVDownmixInfo
*
downmix_info
;
AVDownmixInfo
*
downmix_info
;
...
@@ -1685,7 +1685,7 @@ dependent_frame:
...
@@ -1685,7 +1685,7 @@ dependent_frame:
avctx
->
bit_rate
=
s
->
bit_rate
+
s
->
prev_bit_rate
;
avctx
->
bit_rate
=
s
->
bit_rate
+
s
->
prev_bit_rate
;
}
}
for
(
ch
=
0
;
ch
<
16
;
ch
++
)
for
(
ch
=
0
;
ch
<
EAC3_MAX_CHANNELS
;
ch
++
)
extended_channel_map
[
ch
]
=
ch
;
extended_channel_map
[
ch
]
=
ch
;
if
(
s
->
frame_type
==
EAC3_FRAME_TYPE_DEPENDENT
)
{
if
(
s
->
frame_type
==
EAC3_FRAME_TYPE_DEPENDENT
)
{
...
@@ -1698,7 +1698,7 @@ dependent_frame:
...
@@ -1698,7 +1698,7 @@ dependent_frame:
channel_layout
=
ich_layout
;
channel_layout
=
ich_layout
;
for
(
ch
=
0
;
ch
<
16
;
ch
++
)
{
for
(
ch
=
0
;
ch
<
16
;
ch
++
)
{
if
(
s
->
channel_map
&
(
1
<<
(
15
-
ch
)))
{
if
(
s
->
channel_map
&
(
1
<<
(
EAC3_MAX_CHANNELS
-
ch
-
1
)))
{
channel_layout
|=
custom_channel_map_locations
[
ch
][
1
];
channel_layout
|=
custom_channel_map_locations
[
ch
][
1
];
}
}
}
}
...
@@ -1706,8 +1706,8 @@ dependent_frame:
...
@@ -1706,8 +1706,8 @@ dependent_frame:
avctx
->
channel_layout
=
channel_layout
;
avctx
->
channel_layout
=
channel_layout
;
avctx
->
channels
=
av_get_channel_layout_nb_channels
(
channel_layout
);
avctx
->
channels
=
av_get_channel_layout_nb_channels
(
channel_layout
);
for
(
ch
=
0
;
ch
<
16
;
ch
++
)
{
for
(
ch
=
0
;
ch
<
EAC3_MAX_CHANNELS
;
ch
++
)
{
if
(
s
->
channel_map
&
(
1
<<
(
15
-
ch
)))
{
if
(
s
->
channel_map
&
(
1
<<
(
EAC3_MAX_CHANNELS
-
ch
-
1
)))
{
if
(
custom_channel_map_locations
[
ch
][
0
])
{
if
(
custom_channel_map_locations
[
ch
][
0
])
{
int
index
=
av_get_channel_layout_channel_index
(
channel_layout
,
int
index
=
av_get_channel_layout_channel_index
(
channel_layout
,
custom_channel_map_locations
[
ch
][
1
]);
custom_channel_map_locations
[
ch
][
1
]);
...
...
libavcodec/ac3dec.h
View file @
0b86ea03
...
@@ -242,12 +242,12 @@ typedef struct AC3DecodeContext {
...
@@ -242,12 +242,12 @@ typedef struct AC3DecodeContext {
///@name Aligned arrays
///@name Aligned arrays
DECLARE_ALIGNED
(
16
,
int
,
fixed_coeffs
)[
AC3_MAX_CHANNELS
][
AC3_MAX_COEFS
];
///< fixed-point transform coefficients
DECLARE_ALIGNED
(
16
,
int
,
fixed_coeffs
)[
AC3_MAX_CHANNELS
][
AC3_MAX_COEFS
];
///< fixed-point transform coefficients
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
transform_coeffs
)[
AC3_MAX_CHANNELS
][
AC3_MAX_COEFS
];
///< transform coefficients
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
transform_coeffs
)[
AC3_MAX_CHANNELS
][
AC3_MAX_COEFS
];
///< transform coefficients
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
delay
)[
2
*
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
];
///< delay - added to the next block
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
delay
)[
E
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
];
///< delay - added to the next block
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
window
)[
AC3_BLOCK_SIZE
];
///< window coefficients
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
window
)[
AC3_BLOCK_SIZE
];
///< window coefficients
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
tmp_output
)[
AC3_BLOCK_SIZE
];
///< temporary storage for output before windowing
DECLARE_ALIGNED
(
32
,
INTFLOAT
,
tmp_output
)[
AC3_BLOCK_SIZE
];
///< temporary storage for output before windowing
DECLARE_ALIGNED
(
32
,
SHORTFLOAT
,
output
)[
2
*
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
];
///< output after imdct transform and windowing
DECLARE_ALIGNED
(
32
,
SHORTFLOAT
,
output
)[
E
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
];
///< output after imdct transform and windowing
DECLARE_ALIGNED
(
32
,
uint8_t
,
input_buffer
)[
AC3_FRAME_BUFFER_SIZE
+
AV_INPUT_BUFFER_PADDING_SIZE
];
///< temp buffer to prevent overread
DECLARE_ALIGNED
(
32
,
uint8_t
,
input_buffer
)[
AC3_FRAME_BUFFER_SIZE
+
AV_INPUT_BUFFER_PADDING_SIZE
];
///< temp buffer to prevent overread
DECLARE_ALIGNED
(
32
,
SHORTFLOAT
,
output_buffer
)[
2
*
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
*
6
];
///< final output buffer
DECLARE_ALIGNED
(
32
,
SHORTFLOAT
,
output_buffer
)[
E
AC3_MAX_CHANNELS
][
AC3_BLOCK_SIZE
*
6
];
///< final output buffer
///@}
///@}
}
AC3DecodeContext
;
}
AC3DecodeContext
;
...
...
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