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 |
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
|
|
|
|
|
CParser: Suggest check for overflow in ReadInt, ReadDouble...
By: hans on Thu, 17 October 2013 21:35
|
|
|
Re: CParser: Suggest check for overflow in ReadInt, ReadDouble...
By: mirek on Fri, 18 October 2013 07:44
|
|
|
Re: CParser: Suggest check for overflow in ReadInt, ReadDouble...
By: mirek on Mon, 21 October 2013 20:36
|
|
|
Re: CParser: Suggest check for overflow in ReadInt, ReadDouble...
By: hans on Mon, 21 October 2013 22:57
|
|
|
Re: CParser: Suggest check for overflow in ReadInt, ReadDouble...
By: mirek on Tue, 22 October 2013 07:41
|
|
|
Re: CParser: Suggest check for overflow in ReadInt, ReadDouble...
By: mirek on Wed, 23 October 2013 07:51
|
Goto Forum:
Current Time: Sun May 05 05:42:38 CEST 2024
Total time taken to generate the page: 0.02557 seconds
|