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 651546 - json-glib doesn't support unicode surrogate pair encoding
json-glib doesn't support unicode surrogate pair encoding
Status: RESOLVED OBSOLETE
Product: json-glib
Classification: Core
Component: Parser
0.13.x
Other Linux
: Normal normal
: ---
Assigned To: json-glib-maint
json-glib-maint
Depends on:
Blocks:
 
 
Reported: 2011-05-31 13:00 UTC by Laurent Bigonville
Modified: 2012-03-13 22:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch proposed on ubuntu launchpad (2.14 KB, patch)
2011-05-31 15:13 UTC, Laurent Bigonville
rejected Details | Review

Description Laurent Bigonville 2011-05-31 13:00:09 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.
Comment 1 Emmanuele Bassi (:ebassi) 2011-05-31 14:45:21 UTC
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>
Comment 2 Laurent Bigonville 2011-05-31 15:13:28 UTC
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
Comment 3 Emmanuele Bassi (:ebassi) 2011-06-01 12:43:38 UTC
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
Comment 4 Emmanuele Bassi (:ebassi) 2011-06-01 12:47:00 UTC
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.
Comment 5 André Klapper 2012-03-13 22:08:30 UTC
[Fixing Default QA assignee for json-glib - see 613232#c1. Sorry for bugmail noise.]