The valid BRE backref tokens are \1 .. \9, and 0 is not a special
character either so \0 is undefined by the standard.
Such undefined escaped characters are treated as literal characters
currently, following existing practice, so \0 is the same as 0.
s--;
break;
default:
- if (!ere && isdigit(*s)) {
+ if (!ere && (unsigned)*s-'1' < 9) {
/* back reference */
int val = *s - '0';
node = tre_ast_new_literal(ctx->mem, BACKREF, val, ctx->position);