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

Adam Domurad adomurad at redhat.com
Mon Jun 4 08:32:35 PDT 2012


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)

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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixPR518.patch
Type: text/x-patch
Size: 7550 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20120604/70140498/fixPR518.patch 


More information about the distro-pkg-dev mailing list