+2010-04-10 Bruno Haible <bruno@clisp.org>
+
+ vasnprintf: Fix crash in %ls directive.
+ * lib/vasnprintf.c (VASNPRINTF): Don't abort when a unconvertible wide
+ string is passed as argument to %ls, with no precision and no width.
+ Reported by Jarno Rajahalme <jarno.rajahalme@nsn.com>.
+
2010-04-10 Bruno Haible <bruno@clisp.org>
vasnprintf: Fix multiple test failures on mingw.
count = wctomb (cbuf, *arg);
# endif
if (count <= 0)
- /* Inconsistency. */
- abort ();
+ {
+ /* Cannot convert. */
+ if (!(result == resultbuf || result == NULL))
+ free (result);
+ if (buf_malloced != NULL)
+ free (buf_malloced);
+ CLEANUP ();
+ errno = EILSEQ;
+ return NULL;
+ }
ENSURE_ALLOCATION (xsum (length, count));
memcpy (result + length, cbuf, count);
length += count;