Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
cb57c95a
Commit
cb57c95a
authored
Feb 28, 2017
by
Sebastien Alaiwan
Committed by
sebastien alaiwan
Mar 01, 2017
Browse files
Fix potential integer overflow in range checking
Change-Id: I20b951bb67f4c2147055751a8cd9534ceddc7215
parent
07e33f4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
av1/common/av1_inv_txfm1d.c
View file @
cb57c95a
...
...
@@ -15,20 +15,23 @@
void
range_check_func
(
int32_t
stage
,
const
int32_t
*
input
,
const
int32_t
*
buf
,
int32_t
size
,
int8_t
bit
)
{
const
int
32
_t
maxValue
=
(
1
<<
(
bit
-
1
))
-
1
;
const
int
32
_t
minValue
=
-
(
1
<<
(
bit
-
1
));
const
int
64
_t
maxValue
=
(
1
LL
<<
(
bit
-
1
))
-
1
;
const
int
64
_t
minValue
=
-
(
1
LL
<<
(
bit
-
1
));
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
if
(
buf
[
i
]
<
minValue
||
buf
[
i
]
>
maxValue
)
{
int
buf_bit
=
get_max_bit
(
abs
(
buf
[
i
]))
+
1
;
printf
(
"======== %s %d overflow ========
\n
"
,
__FILE__
,
__LINE__
);
printf
(
"stage: %d node: %d
\n
"
,
stage
,
i
);
printf
(
"bit: %d buf_bit: %d buf[i]: %d
\n
"
,
bit
,
buf_bit
,
buf
[
i
]);
printf
(
"input:
\n
"
);
fprintf
(
stderr
,
"Error: coeffs contain out-of-range values
\n
"
);
fprintf
(
stderr
,
"stage: %d
\n
"
,
stage
);
fprintf
(
stderr
,
"node: %d
\n
"
,
i
);
fprintf
(
stderr
,
"allowed range: [%d;%d]
\n
"
,
minValue
,
maxValue
);
fprintf
(
stderr
,
"coeffs: "
);
fprintf
(
stderr
,
"["
);
for
(
int
j
=
0
;
j
<
size
;
j
++
)
{
printf
(
"%d,"
,
input
[
j
]);
if
(
j
>
0
)
fprintf
(
stderr
,
", "
);
fprintf
(
stderr
,
"%d"
,
input
[
j
]);
}
printf
(
"
\n
"
);
f
printf
(
stderr
,
"]
\n
"
);
assert
(
0
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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