Skip to content
This repository

feeding [rest-json] output to [json-decode] crashes on Mac OS X #4

Closed
eighthave opened this Issue January 30, 2012 · 4 comments

2 participants

Hans-Christoph Steiner Thomas Mayer
Hans-Christoph Steiner

I open rest-json-help.pd, replace [print data] with [json-decode] and click one of the URLs, and it crashes every time for me. I'm using Pd-extended 0.43.1 20120119 64-bit build on Mac OS X 10.6.8. purest_json is built against json-c 0.9 and libcurl 7.24.0.

0 libjson.0.dylib 0x0000000106a95bdc json_object_put + 12
1 pd 0x0000000100027782 outlet_list + 82
2 libpurest_json.dylib 0x0000000106a9fac9 output_json + 473 (libpurest_json.c:48)
3 rest-json.pd_darwin 0x0000000106aa374c execute_rest_thread + 284 (rest-json.c:163)
4 libSystem.B.dylib 0x000000010017dfd6 _pthread_start + 331
5 libSystem.B.dylib 0x000000010017de89 thread_start + 13

Using the 32-bit Mac OS X build with , I also get a similar crash:
0 libjson.0.dylib 0x190e609a json_object_put + 10
1 pd 0x0002ccad outlet_list + 77
2 libpurest_json.dylib 0x190eedd9 output_json + 665
3 ??? 0x0604d200 0 + 100979200
4 ??? 0x65736e6f 0 + 1702063727

Thomas Mayer
Owner

[rest-json] outputs a series of lists, while [json-decode] takes a string as an input. You will have to do something like this currently:

[rest-json]
|
[list trim]
|
[route commits] <--- or something similar
|
[json-decode]
|
[print  decoded]
Hans-Christoph Steiner

Ah, ok makes sense. Figuring out how to represent json's nested lists in Pd is a tricky problem. It would be nice if output_json() didn't crash given bad input.

Thomas Mayer
Owner

I am working on it right now. I am thinking about decoding the nested objects, and outputting them, therefore making the list trim and route unnecessary.

Thomas Mayer
Owner

I have just found the source of the segfault: A call to json_object_put without testing for json errors with is_error first. Will commit that later.

Thomas Mayer residuum referenced this issue from a commit January 30, 2012
Thomas Mayer Fixing issue #4:
- test for is_error(jobj) before json_object_put(jobj)
- using lists for [json-decode]
6624bc6
Thomas Mayer residuum closed this January 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.