Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 24 May 2021 00:39:35 -0400
From: Konstantin Isakov <dragonroot@...il.com>
To: musl@...ts.openwall.com
Subject: [BUG] swprintf() doesn't handle Unicode characters correctly

Hi,

The following program:

===================================
#include <stdio.h>
#include <wchar.h>

int main()
{
  wchar_t buf[ 32 ];

  swprintf( buf, sizeof( buf ) / sizeof( *buf ), L"ab\u00E1c" );

  for ( wchar_t * p = buf; *p; ++p )
    printf( "%u\n", ( unsigned ) *p );

  return 0;
}
===================================

With musl 1.2.2 produces the following output:
97
98

The expected output is:
97
98
225
99

With musl, only the first two characters ('a' and 'b') are processed, and
the string ends on a Unicode character (U+00E1, which is an 'a' with acute
accent), instead of outputting it and the last character, 'c'.

Please CC me when replying. Thanks!

Content of type "text/html" skipped

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.