Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
cf1a259a
Commit
cf1a259a
authored
Jan 06, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
g722enc: validate AVCodecContext.trellis
parent
77c5b66c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
g722enc.c
libavcodec/g722enc.c
+16
-0
No files found.
libavcodec/g722enc.c
View file @
cf1a259a
...
...
@@ -36,6 +36,11 @@
problems, so we limit it to a reasonable value */
#define MAX_FRAME_SIZE 32768
/* We clip the value of avctx->trellis to prevent data type overflows and
undefined behavior. Using larger values is insanely slow anyway. */
#define MIN_TRELLIS 0
#define MAX_TRELLIS 16
static
av_cold
int
g722_encode_init
(
AVCodecContext
*
avctx
)
{
G722Context
*
c
=
avctx
->
priv_data
;
...
...
@@ -83,6 +88,17 @@ static av_cold int g722_encode_init(AVCodecContext * avctx)
avctx
->
frame_size
=
320
;
}
if
(
avctx
->
trellis
)
{
/* validate trellis */
if
(
avctx
->
trellis
<
MIN_TRELLIS
||
avctx
->
trellis
>
MAX_TRELLIS
)
{
int
new_trellis
=
av_clip
(
avctx
->
trellis
,
MIN_TRELLIS
,
MAX_TRELLIS
);
av_log
(
avctx
,
AV_LOG_WARNING
,
"Requested trellis value is not "
"allowed. Using %d instead of %d
\n
"
,
new_trellis
,
avctx
->
trellis
);
avctx
->
trellis
=
new_trellis
;
}
}
return
0
;
}
...
...
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