Package: libthai0
Version: 0.1.23-1

The following program runs to completion (and appears to produce correct
output, to the extent I can tell, not speaking Thai myself) with libthai
0.1.21, but after upgrading to 0.1.23 it goes into an infinite loop
inside th_wbrk.

#include <thai/thwchar.h>
#include <thai/thwbrk.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <locale.h>

/* expected output:           เพื่อ ให้ เหมาะสม กับ วิถีทาง ประเพณี ทาง ศาสนา 
พุทธ */
static const thwchar_t *x = L"เพื่อให้เหมาะสมกับวิถีทางประเพณีทางศาสนาพุทธ";

int main(void)
{
  int n, s, i, len, *breaks;

  setlocale(LC_ALL, "");
  len = wcslen(x);
  breaks = calloc(len, sizeof(int));
  if (!breaks) return 1;

  n = th_wbrk(x, breaks, len);
  for (s = 0, i = 0; i < n; i++) {
    wprintf(L" %.*ls", breaks[i] - s, x + s);
    s = breaks[i];
  }
  wprintf(L" %.*ls\n", len - s, x + s);
  return 0;
}

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (501, 'unstable'), (500, 'testing'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libthai0 depends on:
ii  libc6         2.19-22
ii  libdatrie1    0.2.10-1
ii  libthai-data  0.1.23-1

libthai0 recommends no packages.

libthai0 suggests no packages.

-- no debconf information

Reply via email to