Skip to content

Commit

Permalink
FIX: throw an error on excess values in any-string construction syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jul 16, 2020
1 parent 69f12b0 commit d0073c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/t-string.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,9 @@ static REBSER *make_binary(REBVAL *arg, REBOOL make)
***********************************************************************/
{
REBCNT i;

if (!ANY_BINSTR(data)) return FALSE;
// allow only #[string! "data"] or #[string! "data" index]
if (!(ANY_BINSTR(data) && (IS_END(data+1) || (IS_INTEGER(data+1) && IS_END(data+2)))))
return FALSE;
*out = *data++;
VAL_SET(out, type);
i = IS_INTEGER(data) ? Int32(data) - 1 : 0;
Expand Down

0 comments on commit d0073c4

Please sign in to comment.