Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/vm/wren_compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ static void makeNumber(Parser* parser, bool isHex)

if (isHex)
{
parser->next.value = NUM_VAL((double)strtoll(parser->tokenStart, NULL, 16));
parser->next.value = NUM_VAL((double)strtoull(parser->tokenStart, NULL, 16));
}
else
{
Expand All @@ -763,7 +763,7 @@ static void makeNumber(Parser* parser, bool isHex)
parser->next.value = NUM_VAL(0);
}

// We don't check that the entire token is consumed after calling strtoll()
// We don't check that the entire token is consumed after calling strtoull()
// or strtod() because we've already scanned it ourselves and know it's valid.

makeToken(parser, TOKEN_NUMBER);
Expand Down
2 changes: 2 additions & 0 deletions test/core/number/hex_literal_uint64_max.wren
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// 0xFFFFFFFFFFFFFFFF overflows signed strtoll; must parse as unsigned (strtoull).
System.print(0xFFFFFFFFFFFFFFFF) // expect: 1.844674407371e+19