Page 1 of 1

Convert doesn't properly escape JSON output

Posted: 2015-06-22T08:26:52-07:00
by edalquist
I'm using the following command to extract a metadata dump from images for later processing:
"convert IMAGEFILE -moments json:-"

I've found a few issues where the JSON output is invalid due to ImageMagick not escaping the property values correctly.

There is an example image and JSON output file here:
https://drive.google.com/folderview?id= ... sp=sharing

Re: Convert doesn't properly escape JSON output

Posted: 2015-06-22T09:05:15-07:00
by edalquist
It looks like just adding a basic JSON string escaping into ./coders/json.c might fix the issue, I might see if I can fix it tonight.

Re: Convert doesn't properly escape JSON output

Posted: 2015-06-22T09:42:21-07:00
by dlemstra
Feel free to submit a pull request on github or post your patch here.

Re: Convert doesn't properly escape JSON output

Posted: 2015-06-22T10:02:24-07:00
by edalquist
Oh I had found the svn code, would https://github.com/ImageMagick/ImageMagick be the correct place to submit a patch?

C is not my strong suit but I figure adding a simple string escaping method in one file should be easy enough.

Re: Convert doesn't properly escape JSON output

Posted: 2015-06-22T12:07:02-07:00
by dlemstra
That is indeed our github page.

Re: Convert doesn't properly escape JSON output

Posted: 2015-06-27T09:58:00-07:00
by edalquist
Thanks for merging (a much better version of) the fix!
https://github.com/ImageMagick/ImageMagick/pull/14