Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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-ref... https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...



I compile most of my C# code with integer overflow checking enabled. Better an unexpected exception, than whatever unpredictable behaviour an incorrect result causes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: