Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Wed, 08 May 2024 23:42:04 +0000
From: Oliver Webb <aquahobbyist@...ton.me>
To: "musl@...ts.openwall.com" <musl@...ts.openwall.com>
Subject: regexec(): not matching ASCII in latin1/"bad utf8" text while on a UTF8 locale

The boiled down code example code for this is:

#include <regex.h>
#include <stdio.h>
#include <locale.h>
int main() {
  uselocale(newlocale(LC_CTYPE_MASK, "C.UTF-8", 0));
  regex_t r; regcomp(&r, "\n", 0);
  printf("%d\n", regexec(&r, "\xb5\n", 0, 0, 0) == REG_NOMATCH);
}



(\xb5 can be substituted for any latin1 or improper utf8)

Which on glibc will print 0, on musl it will print 1

Thanks,

-   Oliver Webb <aquahobbyist@...ton.me>

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.