8f026259d8
The following conditions lead to the error: - A pair of nested functions, both of which must be inlined. - Both inlined functions create a variable with the same name. - The outer function passes its variable to the inner function. - The initialization of the inner variable uses the value from the outer variable. - The inner function does not mutate the variable, use it as an out- parameter, or otherwise cause it to receive a temporary copy. When all these conditions are met, both variable declarations are inlined as-is without performing any name salting, because it's seemingly safe to do so. The name overlap issue is not considered in the safety checks. Inlined variable declarations are not subject to name salting but they should be; I suspect other adversarial examples could be crafted as well where unhandled name overlap leads to errors. Change-Id: Ia754bee8e45c8a5c7548436594bbf04abc7a8396 Bug: skia:10722 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316945 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
16 lines
256 B
Plaintext
16 lines
256 B
Plaintext
in half2 x;
|
|
inline half2 InlineB(half2 tmp)
|
|
{
|
|
half2 reusedName = tmp + half2(3, 4);
|
|
return reusedName;
|
|
}
|
|
inline half2 InlineA()
|
|
{
|
|
half2 reusedName = x + half2(1, 2);
|
|
return InlineB(reusedName);
|
|
}
|
|
half4 main()
|
|
{
|
|
return InlineA().xyxy;
|
|
}
|