GNOME Bugzilla – Bug 651546
json-glib doesn't support unicode surrogate pair encoding
Last modified: 2012-03-13 22:08:30 UTC
Hi, I'm reporting a bug opened on ubuntu launchpad. https://bugs.launchpad.net/ubuntu/+source/json-glib/+bug/610606 json-glib didn't support surrogate pair encoding. This example input will make json-glib crash. { "crash":"\ud835\ude82\ud835\ude8e\ud835\ude90\ud835\ude8a\ud835\ude95\ud835\ude8a" } I attached the patch to solve this problem. regards.
you should attach the patch here, as well as a segfault backtrace, so I can do a proper review. plus, surrogate pairs were supposedly fixed with this commit: commit fcd07918d3ed2b31b047900da9d2fed23dddf7da Author: Eiichi Sato <eiichi.for.public@gmail.com> Date: Sat Apr 10 01:52:10 2010 +0900 Support for surrogate pairs in json string. https://bugzilla.gnome.org/show_bug.cgi?id=615799 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Created attachment 188945 [details] [review] patch proposed on ubuntu launchpad Well I'm only the forwarded of the bug opened on launchpad. So I'm sorry I can't provide a backtrace for this one
Review of attachment 188945 [details] [review]: the patch as it is it is now reviewable and will never be accepted. ::: ./json-glib-0.10.2/json-glib/json-scanner.c @@ +893,3 @@ } + /*jagad: check surrogate */ + if ( g_unichar_type(uchar) != G_UNICODE_SURROGATE ) the coding style is wrong @@ +1438,3 @@ if (is_hex_digit (fchar)) { + gunichar ucs; no tabs, only spaces
looking at the code, and as I thought, this bug has already been fixed in JSON-GLib 0.12 by the commit above, and backported to the json-glib-0-10 branch as well: commit 3046a0222e73a3da2d87eb088302de45e2846aa0 Author: Eiichi Sato <eiichi.for.public@gmail.com> Date: Sat Apr 10 01:52:10 2010 +0900 Support for surrogate pairs in json string. https://bugzilla.gnome.org/show_bug.cgi?id=615799 (cherry picked from commit fcd07918d3ed2b31b047900da9d2fed23dddf7da) Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com> if you're still shipping json-glib 0.10 then you probably want to cherry pick this patch instead of the one attached.
[Fixing Default QA assignee for json-glib - see 613232#c1. Sorry for bugmail noise.]