Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
9ab9aa37
Commit
9ab9aa37
authored
Sep 27, 2014
by
Tristan Matthews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
twolame: avoid buffer overflow
Refs #12298
parent
9b196c63
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
modules/codec/twolame.c
modules/codec/twolame.c
+17
-5
No files found.
modules/codec/twolame.c
View file @
9ab9aa37
...
@@ -251,12 +251,24 @@ static int OpenEncoder( vlc_object_t *p_this )
...
@@ -251,12 +251,24 @@ static int OpenEncoder( vlc_object_t *p_this )
****************************************************************************/
****************************************************************************/
static
void
Bufferize
(
encoder_t
*
p_enc
,
int16_t
*
p_in
,
int
i_nb_samples
)
static
void
Bufferize
(
encoder_t
*
p_enc
,
int16_t
*
p_in
,
int
i_nb_samples
)
{
{
int16_t
*
p_buffer
=
p_enc
->
p_sys
->
p_buffer
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
+
(
p_enc
->
p_sys
->
i_nb_samples
const
unsigned
i_offset
=
p_sys
->
i_nb_samples
*
p_enc
->
fmt_in
.
audio
.
i_channels
;
*
p_enc
->
fmt_in
.
audio
.
i_channels
);
const
unsigned
i_len
=
ARRAY_SIZE
(
p_sys
->
p_buffer
);
if
(
i_offset
>=
i_len
)
{
msg_Err
(
p_enc
,
"buffer full"
);
return
;
}
unsigned
i_copy
=
i_nb_samples
*
p_enc
->
fmt_in
.
audio
.
i_channels
;
if
(
i_copy
+
i_offset
>
i_len
)
{
msg_Err
(
p_enc
,
"dropping samples"
);
i_copy
=
i_len
-
i_offset
;
}
memcpy
(
p_buffer
,
p_in
,
i_nb_samples
*
p_enc
->
fmt_in
.
audio
.
i_channels
memcpy
(
p_sys
->
p_buffer
+
i_offset
,
p_in
,
i_copy
*
sizeof
(
int16_t
)
);
*
sizeof
(
int16_t
)
);
}
}
static
block_t
*
Encode
(
encoder_t
*
p_enc
,
block_t
*
p_aout_buf
)
static
block_t
*
Encode
(
encoder_t
*
p_enc
,
block_t
*
p_aout_buf
)
...
...
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