/pidgin/main: 56c7dbe97266: facebook-json:`Special-case "$" to r...

dequis dx at dxzone.com.ar
Mon Dec 21 16:38:17 EST 2015


Changeset: 56c7dbe972663344a58e6994b8ccaa0a162b73f9
Author:	 dequis <dx at dxzone.com.ar>
Date:	 2015-12-21 16:31 -0500
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/56c7dbe97266

Description:

facebook-json:`Special-case "$" to return root for json-glib < 0.99.2

Older glib versions didn't consider "$" to be a valid expression, and
threw this error:

    Root node followed by invalid character '

(That's supposed to be '%c' with a \0)

Since this is possibly the simplest expression to parse, a g_strcmp0()
can do the job.

Thanks to advcomp2019 for reporting this bug and finding a test case
where this issue is reproducible every time (receiving events of people
joining or leaving in a groupchat)

Also thanks to EionRobb who realized what the bug was three hours ago
(and I didn't listen because I thought the previous bug was the same)

diffstat:

 libpurple/protocols/facebook/json.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff --git a/libpurple/protocols/facebook/json.c b/libpurple/protocols/facebook/json.c
--- a/libpurple/protocols/facebook/json.c
+++ b/libpurple/protocols/facebook/json.c
@@ -290,6 +290,11 @@ fb_json_node_get(JsonNode *root, const g
 	JsonNode *node;
 	JsonNode *ret;
 
+	/* Special case for json-glib < 0.99.2 */
+	if (purple_strequal(expr, "$")) {
+		return json_node_copy(root);
+	}
+
 	node = json_path_query(expr, root, &err);
 
 	if (err != NULL) {



More information about the Commits mailing list