After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 580947 - Validate UTF-8 strings in gjs_string_to_utf8()
Validate UTF-8 strings in gjs_string_to_utf8()
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2009-04-30 21:51 UTC by Owen Taylor
Modified: 2009-05-05 20:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Validate UTF-8 strings in gjs_string_to_utf8() (3.13 KB, patch)
2009-04-30 21:51 UTC, Owen Taylor
none Details | Review

Description Owen Taylor 2009-04-30 21:51:26 UTC
Make sure that when converting a Javascript string to UTF-8 it is valid
in GLib terms and doesn't contain any embedded NULs.
Comment 1 Owen Taylor 2009-04-30 21:51:39 UTC
Created attachment 133692 [details] [review]
Validate UTF-8 strings in gjs_string_to_utf8()
Comment 2 Havoc Pennington 2009-04-30 22:31:37 UTC
It seems a bit odd that utf16_to_utf8 is happy to spit out invalid utf8 from invalid utf16, but I guess that's how it works.

Patch looks fine to me.
Comment 3 Owen Taylor 2009-05-01 19:31:15 UTC
It surprised me a bit too. (Presumably I knew that it didnt' validate at some point since I wrote it, but it's been a long time.) Note that *most* validation is already done - the only part that can be invalid is that the result can contain non-characters.
Comment 4 Owen Taylor 2009-05-05 20:26:25 UTC
Pushed.