Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
x264
Commits
41c56f5e
Commit
41c56f5e
authored
May 04, 2011
by
Anton Mitrofanov
Committed by
Fiona Glaser
May 10, 2011
Browse files
More validation of input parameters
This fixes a crash with --me umh and insane values of --me-range.
parent
91965e48
Changes
1
Show whitespace changes
Inline
Side-by-side
encoder/encoder.c
View file @
41c56f5e
...
@@ -532,10 +532,10 @@ static int x264_validate_parameters( x264_t *h, int b_open )
...
@@ -532,10 +532,10 @@ static int x264_validate_parameters( x264_t *h, int b_open )
h
->
param
.
rc
.
i_qp_max
=
x264_clip3
(
h
->
param
.
rc
.
i_qp_max
,
0
,
QP_MAX
);
h
->
param
.
rc
.
i_qp_max
=
x264_clip3
(
h
->
param
.
rc
.
i_qp_max
,
0
,
QP_MAX
);
h
->
param
.
rc
.
i_qp_min
=
x264_clip3
(
h
->
param
.
rc
.
i_qp_min
,
0
,
h
->
param
.
rc
.
i_qp_max
);
h
->
param
.
rc
.
i_qp_min
=
x264_clip3
(
h
->
param
.
rc
.
i_qp_min
,
0
,
h
->
param
.
rc
.
i_qp_max
);
h
->
param
.
rc
.
i_qp_step
=
x264_clip3
(
h
->
param
.
rc
.
i_qp_step
,
0
,
QP_MAX
);
h
->
param
.
rc
.
i_qp_step
=
x264_clip3
(
h
->
param
.
rc
.
i_qp_step
,
0
,
QP_MAX
);
h
->
param
.
rc
.
i_bitrate
=
X
264_
MAX
(
h
->
param
.
rc
.
i_bitrate
,
0
);
h
->
param
.
rc
.
i_bitrate
=
x
264_
clip3
(
h
->
param
.
rc
.
i_bitrate
,
0
,
2000000
);
h
->
param
.
rc
.
i_vbv_buffer_size
=
X
264_
MAX
(
h
->
param
.
rc
.
i_vbv_buffer_size
,
0
);
h
->
param
.
rc
.
i_vbv_buffer_size
=
x
264_
clip3
(
h
->
param
.
rc
.
i_vbv_buffer_size
,
0
,
2000000
);
h
->
param
.
rc
.
i_vbv_max_bitrate
=
X
264_
MAX
(
h
->
param
.
rc
.
i_vbv_max_bitrate
,
0
);
h
->
param
.
rc
.
i_vbv_max_bitrate
=
x
264_
clip3
(
h
->
param
.
rc
.
i_vbv_max_bitrate
,
0
,
2000000
);
h
->
param
.
rc
.
f_vbv_buffer_init
=
X
264_
MAX
(
h
->
param
.
rc
.
f_vbv_buffer_init
,
0
);
h
->
param
.
rc
.
f_vbv_buffer_init
=
x
264_
clip3f
(
h
->
param
.
rc
.
f_vbv_buffer_init
,
0
,
2000000
);
if
(
h
->
param
.
rc
.
i_vbv_buffer_size
)
if
(
h
->
param
.
rc
.
i_vbv_buffer_size
)
{
{
if
(
h
->
param
.
rc
.
i_rc_method
==
X264_RC_CQP
)
if
(
h
->
param
.
rc
.
i_rc_method
==
X264_RC_CQP
)
...
@@ -701,8 +701,7 @@ static int x264_validate_parameters( x264_t *h, int b_open )
...
@@ -701,8 +701,7 @@ static int x264_validate_parameters( x264_t *h, int b_open )
if
(
h
->
param
.
analyse
.
i_me_method
<
X264_ME_DIA
||
if
(
h
->
param
.
analyse
.
i_me_method
<
X264_ME_DIA
||
h
->
param
.
analyse
.
i_me_method
>
X264_ME_TESA
)
h
->
param
.
analyse
.
i_me_method
>
X264_ME_TESA
)
h
->
param
.
analyse
.
i_me_method
=
X264_ME_HEX
;
h
->
param
.
analyse
.
i_me_method
=
X264_ME_HEX
;
if
(
h
->
param
.
analyse
.
i_me_range
<
4
)
h
->
param
.
analyse
.
i_me_range
=
x264_clip3
(
h
->
param
.
analyse
.
i_me_range
,
4
,
1024
);
h
->
param
.
analyse
.
i_me_range
=
4
;
if
(
h
->
param
.
analyse
.
i_me_range
>
16
&&
h
->
param
.
analyse
.
i_me_method
<=
X264_ME_HEX
)
if
(
h
->
param
.
analyse
.
i_me_range
>
16
&&
h
->
param
.
analyse
.
i_me_method
<=
X264_ME_HEX
)
h
->
param
.
analyse
.
i_me_range
=
16
;
h
->
param
.
analyse
.
i_me_range
=
16
;
if
(
h
->
param
.
analyse
.
i_me_method
==
X264_ME_TESA
&&
if
(
h
->
param
.
analyse
.
i_me_method
==
X264_ME_TESA
&&
...
...
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