Handle NetBSD specific iconv_open(3) behavior for empty codesets According to POSIX materials:
"Settings of fromcode and tocode and their permitted combinations are implementation-defined." -- http://pubs.opengroup.org/onlinepubs/009695399/functions/iconv_open.html NetBSD doesn't allow empty strings to be passed to this function: $ cat /tmp/test.c #include <iconv.h> #include <err.h> #include <stdlib.h> #include <stdio.h> int main(int argc, char **argv) { iconv_t h = iconv_open("", "UTF-8"); if (h == (iconv_t)-1) err(EXIT_FAILURE, "iconv_open"); printf("OK!\n"); return 0; } $ gcc test.c -o test $ ./test test: iconv_open: Invalid argument This patch is MIT-licensed. Author: Kamil Rytarowski
Handle NetBSD specific iconv_open(3) behavior for empty codesets According to POSIX materials: "Settings of fromcode and tocode and their permitted combinations are implementation-defined." -- http://pubs.opengroup.org/onlinepubs/009695399/functions/iconv_open.html NetBSD doesn't allow empty strings to be passed to this function: $ cat /tmp/test.c #include <iconv.h> #include <err.h> #include <stdlib.h> #include <stdio.h> int main(int argc, char **argv) { iconv_t h = iconv_open("", "UTF-8"); if (h == (iconv_t)-1) err(EXIT_FAILURE, "iconv_open"); printf("OK!\n"); return 0; } $ gcc test.c -o test $ ./test test: iconv_open: Invalid argument This patch is MIT-licensed. Author: Kamil Rytarowski Index: src/VBox/Runtime/r3/posix/utf8-posix.cpp =================================================================== --- src/VBox/Runtime/r3/posix/utf8-posix.cpp (wersja 62125) +++ src/VBox/Runtime/r3/posix/utf8-posix.cpp (kopia robocza) @@ -173,8 +173,8 @@ iconv_t hIconv = (iconv_t)*phIconv; if (hIconv == (iconv_t)-1) { -#ifdef RT_OS_SOLARIS - /* Solaris doesn't grok empty codeset strings, so help it find the current codeset. */ +#if defined(RT_OS_SOLARIS) || defined(RT_OS_NETBSD) + /* Some systems don't grok empty codeset strings, so help it find the current codeset. */ if (!*pszInputCS) pszInputCS = rtStrGetLocaleCodeset(); if (!*pszOutputCS) @@ -494,4 +494,3 @@ } return rtStrConvertWrapper(pszString, cch, "", ppszString, 0, "UTF-8", 2, RTSTRICONV_LOCALE_TO_UTF8); } -
signature.asc
Description: OpenPGP digital signature
_______________________________________________ vbox-dev mailing list vbox-dev@virtualbox.org https://www.virtualbox.org/mailman/listinfo/vbox-dev