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
8305041e
Commit
8305041e
authored
Oct 20, 2011
by
Ronald S. Bultje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swscale: prevent overflow in coefficient calculation.
parent
65d3176a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
utils.c
libswscale/utils.c
+12
-11
No files found.
libswscale/utils.c
View file @
8305041e
...
...
@@ -271,19 +271,20 @@ static int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSi
floatd
=
d
*
(
1
.
0
/
(
1
<<
30
));
if
(
flags
&
SWS_BICUBIC
)
{
#define SQRT_INT64_MAX 0xb504f333
int64_t
B
=
(
param
[
0
]
!=
SWS_PARAM_DEFAULT
?
param
[
0
]
:
0
)
*
(
1
<<
24
);
int64_t
C
=
(
param
[
1
]
!=
SWS_PARAM_DEFAULT
?
param
[
1
]
:
0
.
6
)
*
(
1
<<
24
);
int64_t
dd
=
d
>
SQRT_INT64_MAX
?
((
d
>>
1
)
*
d
)
>>
29
:
(
d
*
d
)
>>
30
;
int64_t
ddd
=
d
>
SQRT_INT64_MAX
||
dd
>
SQRT_INT64_MAX
?
((
dd
>>
2
)
*
d
)
>>
28
:
(
dd
*
d
)
>>
30
;
if
(
d
<
1LL
<<
30
)
coeff
=
(
12
*
(
1
<<
24
)
-
9
*
B
-
6
*
C
)
*
ddd
+
(
-
18
*
(
1
<<
24
)
+
12
*
B
+
6
*
C
)
*
dd
+
(
6
*
(
1
<<
24
)
-
2
*
B
)
*
(
1
<<
30
);
else
if
(
d
<
1LL
<<
31
)
coeff
=
(
-
B
-
6
*
C
)
*
ddd
+
(
6
*
B
+
30
*
C
)
*
dd
+
(
-
12
*
B
-
48
*
C
)
*
d
+
(
8
*
B
+
24
*
C
)
*
(
1
<<
30
);
else
coeff
=
0
.
0
;
if
(
d
>=
1LL
<<
31
)
{
coeff
=
0
.
0
;
}
else
{
int64_t
dd
=
(
d
*
d
)
>>
30
;
int64_t
ddd
=
(
dd
*
d
)
>>
30
;
if
(
d
<
1LL
<<
30
)
coeff
=
(
12
*
(
1
<<
24
)
-
9
*
B
-
6
*
C
)
*
ddd
+
(
-
18
*
(
1
<<
24
)
+
12
*
B
+
6
*
C
)
*
dd
+
(
6
*
(
1
<<
24
)
-
2
*
B
)
*
(
1
<<
30
);
else
coeff
=
(
-
B
-
6
*
C
)
*
ddd
+
(
6
*
B
+
30
*
C
)
*
dd
+
(
-
12
*
B
-
48
*
C
)
*
d
+
(
8
*
B
+
24
*
C
)
*
(
1
<<
30
);
}
coeff
*=
fone
>>
(
30
+
24
);
}
/* else if (flags & SWS_X) {
...
...
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