Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on isdigit, isalpha, isspace with char > 127 #70

Open
ghost opened this issue May 2, 2021 · 0 comments
Open

Error on isdigit, isalpha, isspace with char > 127 #70

ghost opened this issue May 2, 2021 · 0 comments

Comments

@ghost
Copy link

ghost commented May 2, 2021

The is*** functions to check if a char is a digit or space fail if you pass a char that's above 127.

https://en.cppreference.com/w/cpp/string/byte/isalpha

Depending on your compiler you might get an error. You can fix this by casting the value to unsigned char.
Try and match this "Çüéâ" as ASCII.

static int matchdigit(char c)
{
  return isdigit((unsigned char)c);
}
static int matchalpha(char c)
{
  return isalpha((unsigned char)c);
}
static int matchwhitespace(char c)
{
  return isspace((unsigned char)c);
}
rurban pushed a commit to rurban/tiny-regex-c that referenced this issue Jun 10, 2022
and fix isalpha crashes on bad libc's. Fixes GH kokke#70.
e.g. UTF-8.
rurban pushed a commit to rurban/tiny-regex-c that referenced this issue Jun 10, 2022
and fix isalpha crashes on bad libc's. Fixes GH kokke#70.
e.g. UTF-8.
rurban pushed a commit to rurban/tiny-regex-c that referenced this issue Jun 11, 2022
and fix isalpha crashes on bad libc's. Fixes GH kokke#70.
e.g. UTF-8.
@rurban rurban mentioned this issue Jun 11, 2022
rurban pushed a commit to rurban/tiny-regex-c that referenced this issue Jun 11, 2022
and fix isalpha crashes on bad libc's. Fixes GH kokke#70.
e.g. UTF-8.
rurban pushed a commit to rurban/tiny-regex-c that referenced this issue Jun 20, 2022
and fix isalpha crashes on bad libc's. Fixes GH kokke#70.
e.g. UTF-8.
matyalatte added a commit to matyalatte/tiny-str-match that referenced this issue Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants