Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Large JSON file crashes encode/decode #43

Closed
nyboer opened this issue May 6, 2016 · 4 comments
Closed

Large JSON file crashes encode/decode #43

nyboer opened this issue May 6, 2016 · 4 comments
Labels

Comments

@nyboer
Copy link

nyboer commented May 6, 2016

Working on an ARM7 computer (NTC CHIP) running a debian 4.3 kernel.
I opened this file with json_encode and tried to decode it. PD 046-7 crashes. Yes, it's quite big, as far as JSON files go. Using purest json installed with apt-get from stretch repo.

sis.txt
patchimg

@residuum
Copy link
Owner

residuum commented May 9, 2016

Does the problem occur, when you load the file for the second time? If so, then I can reproduce this bug, because [json-encode] is then crashing while freeing the first stored object.

@nyboer
Copy link
Author

nyboer commented May 9, 2016

Yes, it seems to be a problem on the 2nd click. If I click it once, it seems to do nothing, if I click it again, it crashes pd with an error like:

*** Error in `pd': free(): invalid pointer: 0x000ed7cf ***

Also, I tried to hang a "print" object off the end of that [t a a]. PD hangs, and I got

 *** Error in `pd': corrupted double-linked list: 0x000ed878 ***

in the terminal. Can't consistently reproduce that, though.

@residuum
Copy link
Owner

residuum commented Jun 22, 2016

Update:

  1. [read( on [json-encode] does not output anything, it only loads the content of the file. To output the stored JSON, use [bang(.
  2. It boils down to json_object_put() from json-c segfaulting. Investigating in it right now.

@residuum
Copy link
Owner

residuum commented Jun 23, 2016

OK, I have already had the same issue with [json-decode]. Time to make a sample application in C and report the bug to json-c.

This segfaults:

json_object_put(jobj);

This is the segfault in [json-decode]:

/*json_object_put(jobj);*/

Not calling json_object_put() leads to memory leaks, which would be a workaround, but should be fixed. I will commit a hotfix wth a commented out line in json-encode.c, and will work with json-c maintainers to fix that issue later.

Similar issue reported to json-c
json-c/json-c#158

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants