Open xPaw opened 2 months ago
"loose checks on the a/A characters"?
What is this expected to be parsed as - what value does it result in?
"loose checks on the a/A characters"?
They don't check the ranges fully.
for( int i=2; i < 2 + 16; i++ )
{
char digit = value[i];
if ( digit >= 'a' )
digit -= 'a' - ( '9' + 1 );
else
if ( digit >= 'A' )
digit -= 'A' - ( '9' + 1 );
retVal = ( retVal * 16 ) + ( digit - '0' );
}
What is this expected to be parsed as
Looking at that code, probably nothing useful. Maybe we should fallback to not parsing it and return a string?
It passes the 0x prefix and 18 total length check but then fails to parse from hex. Valve's code kind of doesn't care because they do loose checks on the a/A characters and then math it.
I also noticed we check for 0x case insensitive, but valve only checks for lower case x.