[rfc][icedtea-web] Fix for PR518, NPString.utf8characters not guaranteed to be null-terminated

Danesh Dadachanji ddadacha at redhat.com
Fri Jun 8 08:32:23 PDT 2012


On 07/06/12 04:43 PM, Adam Domurad wrote:
> Here is a patch for consideration for backporting that is suitable for
> 1.2&  1.1.
>

Looks good to me for backport. One thing that slipped through the review in the original commit is adding a NEWS entry. Could you do so 
for all 3 branches and post a patch back here? You will have to update the ChangeLog for 1.2 and 1.1 mentioning this too.

Thanks for the backports!

Cheers,
Danesh

> On Mon, 2012-06-04 at 11:53 -0400, Deepak Bhole wrote:
>> * Adam Domurad<adomurad at redhat.com>  [2012-06-04 11:42]:
>>> Hey all. This is a fix for PR518 that adds a utility function for
>>> wrapping NPString's in a null terminated std::string. It is used
>>> wherever utf8characters was accessed previously. This also has the
>>> benefit of consolidating some #ifdef blocks to one location.
>>>
>>> I took the route of using std::string over gchar* as suggested in the
>>> bug report to be conveniently sure memory is freed.
>>>
>>> (Note, passing along std::string's by value is quite efficient because
>>> GCC uses reference counting techniques for sharing of character arrays
>>> used in std::string)
>>>
>>
>> Looks fine to me. OK for HEAD.
>>
>> Cheers,
>> Deepak
>>
>>> ChangeLog:
>>> 2012-06-04  Adam Domurad<adomurad at redhat.com>
>>>
>>> 	This patch fixes PR518, ensures null termination of strings based off
>>> 	of NPVariant results.	
>>> 	* plugin/icedteanp/IcedTeaPluginUtils.h: Added declaration of
>>> 	NPVariantAsString
>>> 	* plugin/icedteanp/IcedTeaPluginUtils.cc
>>> 	(NPVariantAsString): New. Converts an NPVariant to a
>>> 	std::string, assumes it is a string.
>>> 	(isObjectJSArray): Now uses NPVariantAsString, minor cleanup.
>>> 	* plugin/icedteanp/IcedTeaJavaRequestProcessor.cc
>>> 	(plugin_get_documentbase): Now uses NPVariantAsString.
>>> 	* plugin/icedteanp/IcedTeaNPPlugin.cc
>>> 	(NPVariantToString): Now uses NPVariantAsString, minor cleanup.
>>>
>>



More information about the distro-pkg-dev mailing list