skia2/resources/sksl/errors/OverflowUintLiteral.sksl
John Stiles 378e4aecfe Report int-literal overflow via cast-from-float.
The fuzzer discovered that SkSL could create an out-of-range int literal
by casting from a floating point literal. We were only doing range
checks when the starting literal was an integer. Since we now assert
when an out-of-range int literal is created (as of
http://review.skia.org/464124), the fuzzer can detect this error.

Change-Id: Ie66f60ddbe7b4fbe5b648c17292c59a4ba079716
Bug: oss-fuzz:40456
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465385
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-29 14:55:30 +00:00

13 lines
476 B
Plaintext

// Expect 6 errors
uint uintMin = 0;
uint uintMinMinusOne = -1; // error
uint uintMax = 4294967295;
uint uintMaxPlusOne = 4294967296; // error
ushort4 us4_neg = ushort4(2, 1, 0, -1); // error -1
ushort4 us4_pos = ushort4(65536, 65535, 65534, 65533); // error 65536
uint cast_int = uint(4294967296.); // error
ushort cast_short = ushort(65536.); // error