Skip to content

Commit

Permalink
Postfix for #6809 - thanks to Adriano
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPeshkoff committed Jun 1, 2021
1 parent 8df9a93 commit 10bf6bd
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/jrd/cvt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,12 @@ UCHAR CVT_get_numeric(const UCHAR* string, const USHORT length, SSHORT* scale, v
* Functional description
* Convert a numeric literal (string) to its binary value.
*
* If the literal contains an exponent or is too large to fit
* in an int64, return a double, else if the literal is too
* large to fit in a long, return an int64, else return a long.
*
* The return value from the function is set to dtype_double,
* dtype_int64, or dtype_long depending on the conversion performed.
* The binary value (long, int64, or double) is stored at the
* address given by ptr.
* According to the literal passed (contains an exponent or not,
* what datatype fits) returns long, int64, int128, double or decfloat.
*
* The return value from the function is set to dtype_decfloat, dtype_double,
* dtype_int128, dtype_int64 or dtype_long depending on the conversion performed.
* The binary value is stored at the address given by ptr.
*
**************************************/
dsc desc;
Expand All @@ -218,7 +215,7 @@ UCHAR CVT_get_numeric(const UCHAR* string, const USHORT length, SSHORT* scale, v
bool digit_seen = false, fraction = false, over = false;

const UCHAR* p = string;
if (p[0] == '0' && p[1] == 'X')
if (length > 2 && p[0] == '0' && p[1] == 'X')
{
*(Int128*) ptr = CVT_hex_to_int128(reinterpret_cast<const char*>(p + 2), length - 2);
*scale = 0;
Expand Down

0 comments on commit 10bf6bd

Please sign in to comment.