Project

General

Profile

Actions

Bug #2265

open

mbsrtowcs does not properly handle invalid mbstate_t in ps

Added by c.turner1 almost 13 years ago. Updated almost 13 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
12/23/2011
Due date:
% Done:

0%

Estimated time:

Description

Was attempting to fix the lang/racket port and discovered a coredump in the autoconf tests -

this coredumps (-HEAD from ~1mo ago / i386 / gcc44):

#include <wchar.h>
int main() {
mbstate_t state;
char *src = "X";
mbsrtowcs(0, &src, 0, &state);
return 0;
}

whereas this (or passing NULL instead of &state), does not:

#include <wchar.h>
#include <strings.h>
int main() {
mbstate_t state;
bzero(&state, sizeof(mbstate_t));
char *src = "X";
mbsrtowcs(0, &src, 0, &state);
return 0;
}

As I understand it - posix specifies that this should EINVAL as
it is an 'invalid conversion state'

http://pubs.opengroup.org/onlinepubs/009604599/functions/mbsrtowcs.html

that being said, I'm not particularly versed in these routines, in which
case, the test case is likely bad, or perhaps this is unspecified in posix.

comments welcome in reguards to these various factors.

I seem to recall some murmurings about updating citrus at some point -
perhaps this issue is resolved upstream there / could be tackled then.

for now, I'll be hacking the configure script and proceeding with the pkg

Cheers,

- Chris

Actions

Also available in: Atom PDF