Bug 522931 - textToSubURI.UnEscapeAndConvert(UTF-8, null) causes crash in NS_strdup [@strlen | NS_strdup(char const*) ]. r=smontagu

This commit is contained in:
Makoto Kato 2009-10-30 18:17:19 +09:00
Родитель 7e335d7e89
Коммит 1c175e2654
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -119,6 +119,11 @@ NS_IMETHODIMP nsTextToSubURI::UnEscapeAndConvert(
{
if(nsnull == _retval)
return NS_ERROR_NULL_POINTER;
if(nsnull == text) {
// set empty string instead of returning error
// due to compatibility for old version
text = "";
}
*_retval = nsnull;
nsresult rv = NS_OK;

Просмотреть файл

@ -0,0 +1,6 @@
// crash test with invaild parameter (bug 522931)
function run_test()
{
var textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"].getService(Components.interfaces.nsITextToSubURI);
do_check_eq(textToSubURI.UnEscapeAndConvert("UTF-8", null), "");
}