aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDatong Sun <dndx@idndx.com>2022-01-13 08:47:48 +0800
committerGitHub <noreply@github.com>2022-01-13 08:47:48 +0800
commit92cebdcc374a7bb4bf59e1186076433e45cc1138 (patch)
tree820d18de86d944eeba3c03d941c1dbb526951584
parent0f3dda34a35d93b92aba39a6c7b30d1d23918812 (diff)
downloadlua-cjson-92cebdcc374a7bb4bf59e1186076433e45cc1138.tar.gz
lua-cjson-92cebdcc374a7bb4bf59e1186076433e45cc1138.tar.bz2
lua-cjson-92cebdcc374a7bb4bf59e1186076433e45cc1138.zip
bugfix: empty_array can not work on Apple because csjon did not compare light userdata address with masked address (#82)
Since we used `json_lightudata_mask` when creating lightuserdata, same mask should be applied when comparing the return of `touserdata` Fixes #81.
-rw-r--r--lua_cjson.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lua_cjson.c b/lua_cjson.c
index ff61c47..df1794b 100644
--- a/lua_cjson.c
+++ b/lua_cjson.c
@@ -800,7 +800,7 @@ static void json_append_data(lua_State *l, json_config_t *cfg,
800 case LUA_TLIGHTUSERDATA: 800 case LUA_TLIGHTUSERDATA:
801 if (lua_touserdata(l, -1) == NULL) { 801 if (lua_touserdata(l, -1) == NULL) {
802 strbuf_append_mem(json, "null", 4); 802 strbuf_append_mem(json, "null", 4);
803 } else if (lua_touserdata(l, -1) == &json_array) { 803 } else if (lua_touserdata(l, -1) == json_lightudata_mask(&json_array)) {
804 json_append_array(l, cfg, current_depth, json, 0); 804 json_append_array(l, cfg, current_depth, json, 0);
805 } 805 }
806 break; 806 break;