Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd behavior using jshon #53

Closed
apmilen opened this issue Mar 2, 2017 · 5 comments
Closed

Odd behavior using jshon #53

apmilen opened this issue Mar 2, 2017 · 5 comments

Comments

@apmilen
Copy link

apmilen commented Mar 2, 2017

Not really sure what's going on here. I built jshon from this release and get this result when testing it:

$ jshon -e foo <<< '{"foo":"ay4d748edadf7"}'
json read error: line 2 column 1: end of file expected near '_'

however if the string is just one character shorter, it works fine:

$ jshon -e foo <<< '{"foo":"ay4d748edadf"}'
"ay4d748edadf"

another experiment yields a different error:

$ echo -n '{"foo":"ay4d748df7"}' | jshon -e foo
json read error: line 1 column 20: unable to decode byte 0xff

Any idea what might be going wrong?

@NiklasKunkel
Copy link

Have this exact same issue.

mbrock added a commit to mbrock/jshon that referenced this issue Mar 2, 2017
@mbrock
Copy link
Contributor

mbrock commented Mar 2, 2017

I could only reproduce this on my OS X computer.

Basically jshon tries to parse extra garbage when you give it a file or stdin, because it doesn't properly null-terminate its input.

On OS X it seems to happen only when the input size is 15 bytes or bigger (probably because of some intricacies of malloc), while on Linux I seem to always get a pre-zeroed buffer so the problem doesn't show up.

dbrock added a commit to dbrock/nixpkgs that referenced this issue Mar 16, 2017
This fixes a somewhat critical (security?) bug.

We are trying to get it merged upstream but have had no response from
the ordinary maintainer in over a week.

(See <keenerd/jshon#53>.)
Mic92 pushed a commit to NixOS/nixpkgs that referenced this issue Mar 16, 2017
This fixes a somewhat critical (security?) bug.

We are trying to get it merged upstream but have had no response from
the ordinary maintainer in over a week.

(See <keenerd/jshon#53>.)

fixes #23727
Mic92 pushed a commit to NixOS/nixpkgs that referenced this issue Mar 16, 2017
This fixes a somewhat critical (security?) bug.

We are trying to get it merged upstream but have had no response from
the ordinary maintainer in over a week.

(See <keenerd/jshon#53>.)

fixes #23727

(cherry picked from commit 5d6ea2d)
Mic92 pushed a commit to NixOS/nixpkgs that referenced this issue Mar 16, 2017
This fixes a somewhat critical (security?) bug.

We are trying to get it merged upstream but have had no response from
the ordinary maintainer in over a week.

(See <keenerd/jshon#53>.)

fixes #23727

(cherry picked from commit 5d6ea2d)
@dbrock
Copy link

dbrock commented Sep 1, 2017

Bump

@ldanicel
Copy link

ldanicel commented Feb 9, 2018

Double Bump

keenerd pushed a commit that referenced this issue Feb 9, 2018
@keenerd
Copy link
Owner

keenerd commented Feb 9, 2018

Fixed with d919aea. Thank you mbrock.

@keenerd keenerd closed this as completed Feb 9, 2018
adrianpk added a commit to adrianpk/nixpkgs that referenced this issue May 31, 2024
This fixes a somewhat critical (security?) bug.

We are trying to get it merged upstream but have had no response from
the ordinary maintainer in over a week.

(See <keenerd/jshon#53>.)

fixes NixOS#23727

(cherry picked from commit 5d6ea2d)
adrianpk added a commit to adrianpk/nixpkgs that referenced this issue May 31, 2024
This fixes a somewhat critical (security?) bug.

We are trying to get it merged upstream but have had no response from
the ordinary maintainer in over a week.

(See <keenerd/jshon#53>.)

fixes NixOS#23727

(cherry picked from commit 5d6ea2d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants