skia2/resources/sksl/errors/OverflowIntLiteral.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
504 B
Plaintext

// Expect 6 errors
const int intMin = -2147483648;
const int intMinMinusOne = -2147483649; // error
const int intMax = 2147483647;
const int intMaxPlusOne = 2147483648; // error
short4 s4_neg = short4(-32766, -32767, -32769, -32768); // error -32769
short4 s4_pos = short4(32765, 32768, 32766, 32767); // error 32768
int cast_int = int(2147483648.); // error
short cast_short = short(32768.); // error