Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Sema] Change data type in MaxDispatchGrid validation calculation to …
…uint64_t to prevent overflow (microsoft#6090) Previously, in order to determine whether the three arguments provided to the MaxDispatchGrid attribute exceeded the maximum product value (which is 16,777,215 (2^24-1)), each of the three components would be multiplied together and compared to this maximum. However, the three arguments would be read in as unsigned ints. In certain conditions, the multiplication would cause an overflow, which would programmatically result in a number less than the maximum product limit, despite mathematically being above this limit. The diagnostic should trigger in this case, but it doesn't. This PR changes the data type of the three arguments to unsigned long long, which can hold the maximum possible product that can be achieved without triggering the per-multiplicand limit of 65535, and won't overflow in this case. Now, the compiler will trigger this diagnostic. Regression test has been added. Fixes microsoft#5988
- Loading branch information