3 ms·
> Looking back at this line of code, I see two things: purchaseV2Req.currencyQty = client_PurchaseOption.IntegerCost * quantity; > There aren't any checks
by Kwpolska 4y ago
> Looking back at this line of code, I see two things:
purchaseV2Req.currencyQty = client_PurchaseOption.IntegerCost * quantity;
> There aren't any checks for overflows
In C#, this might actually be secure. There is a compiler option that enables overflow checking for all math in your code (but not in your dependencies). But I suppose the decompiler would have put a checked() around the operation in that case.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/checked-and-unchecked https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/language#checkforoverflowunderflow https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...
- CodesInChaos 3y agoI compile most of my C# code with integer overflow checking enabled. Better an unexpected exception, than whatever unpredictable behaviour an incorrect result causes.