Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » CParser: Suggest check for overflow in ReadInt, ReadDouble...
CParser: Suggest check for overflow in ReadInt, ReadDouble... [message #40985] Thu, 17 October 2013 21:35 Go to previous message
hans is currently offline  hans
Messages: 44
Registered: March 2006
Location: Germany
Member
Hi,
I would suggest checking the number string for range in the following functions:

int ReadInt() throw(Error);
int ReadInt(int min, int max) throw(Error);
int64 ReadInt64() throw(Error);
int64 ReadInt64(int64 min, int64 max) throw(Error);
uint32 ReadNumber(int base = 10) throw(Error);
uint64 ReadNumber64(int base = 10) throw(Error);
double ReadDouble() throw(Error);

If the number string would overflow the number range silently a garbage number is returned.

Would be nice if range error is thrown instead.

In ReadInt() and ReadInt64() also should be checked if the unsigned number read internal is lower than half of signed before sign can be applied.

Do others agree?

Hans
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: append in logging not working
Next Topic: how to just get var from parent Layout class?
Goto Forum:
  


Current Time: Sun May 05 05:42:38 CEST 2024

Total time taken to generate the page: 0.02557 seconds