Does C99 specify that this structure would be 0 initialized by default, or is this line missing a = { 0 }? - https://github.com/rxi/sj.h/blob/5cb5df45c8c37fd8c2322026a11... - it reads to me like r->depth might be randomly initialized and equal to depth by random chance on the first iteration of the sj__discard_until loop
Sj.h: A tiny little JSON parsing library in ~150 lines of C99
171–180 of 248 posts
Re: Sj.h: A tiny little JSON parsing library in ~150 lines of C99
#172Does C99 specify that this structure would be 0 initialized by default, or is this line missing a = { 0 }? - https://github.com/rxi/sj.h/blob/5cb5df45c8c37fd8c2322026a11... - it reads to me like r->depth might be randomly initialized and equal to depth by random chance on the first iteration of the sj__discard_until loop
r->depth would have been initialized to zero here https://github.com/rxi/sj.h/blob/5cb5df45c8c37fd8c2322026a11...
Re: Sj.h: A tiny little JSON parsing library in ~150 lines of C99
#173The library doesn’t check for signed integer overflow here: https://github.com/rxi/sj.h/blob/eb725e0858877e86932128836c1... https://github.com/rxi/sj.h/blob/eb725e0858877e86932128836c1... https://github.com/rxi/sj.h/blob/eb725e0858877e86932128836c1... Certain inputs can therefore trigger UB.
Re: Sj.h: A tiny little JSON parsing library in ~150 lines of C99
#174Earlier quoted context omitted.
JSON does not necessarily come from untrusted sources if you control the entire system. Not everything needs to be absolutely 100% secure so long as you control the system. If you are opening the system to the public, then sure, you should strive for security, but that isn't always necessary in projects that are not processing public input. Here's an example - I once coded a limited JSON parser in assembly language.…
> Not everything needs to be absolutely 100% secure so long as you control the system. Isn't that a bit like saying "you don't have to worry about home security as long as you are the only person who has the ability to enter your house"?
Re: Sj.h: A tiny little JSON parsing library in ~150 lines of C99
#175Earlier quoted context omitted.
You're not aware of the simplistic, single header C library culture that some developers like to partake in. Tsoding (a streamer) is a prime example of someone who likes developing/using these types of libraries. They acknowledge that these things aren't focused on "security" or "features" and that's okay. Not everything is a super serious business project exposed to thousands of paying customers.
So if its a hobby project designed for just a handful of people, its suddenly okay to endanger them due to being sloppy?
Re: Sj.h: A tiny little JSON parsing library in ~150 lines of C99
#176Earlier quoted context omitted.
Who cares? Seriously. Whether a commercial entity who wants to be able to benefit from your work accepts the license you choose for work you do is as much a concern as whether or not the prime minister of Liechtenstein accepts the color you paint the outside of your house in the USA. That is: none.
Kinda depends on whether you're publishing open source software so that people can use it. And if you're not publishing open source software so that people can use it, why exactly are you doing it? If you don't want people to use it, GPL is the way to go. If you do want people to use it, MIT or BSD is a much better way to go.
Re: Sj.h: A tiny little JSON parsing library in ~150 lines of C99
#177Earlier quoted context omitted.
The license says otherwise; hard to get freer than public domain.
Open source is a more informative term for this than free software. Not all free software is open source, but all open source software is free. Edit: I was not aware of the FSF's definition. I was using a definition of free software being software that you can use without having to pay for it.
That’s called freeware. Also, open-source software can be paid (with the caveat that if someone buys it, you must allow them to redistribute it for free).
Re: Sj.h: A tiny little JSON parsing library in ~150 lines of C99
#178Earlier quoted context omitted.
An int will be 32 bits on any non-ancient platform, so this means, for each of those lines: - a JSON file with nested values exceeding 2 billion depth - a file with more than 2 billion lines - a line with more than 2 billion characters
2 billion characters seems fairly plausible to hit in the real world
Re: Sj.h: A tiny little JSON parsing library in ~150 lines of C99
#179Earlier quoted context omitted.
Who cares? Seriously. Whether a commercial entity who wants to be able to benefit from your work accepts the license you choose for work you do is as much a concern as whether or not the prime minister of Liechtenstein accepts the color you paint the outside of your house in the USA. That is: none.
Kinda depends on whether you're publishing open source software so that people can use it. And if you're not publishing open source software so that people can use it, why exactly are you doing it? If you don't want people to use it, GPL is the way to go. If you do want people to use it, MIT or BSD is a much better way to go.
lol
Re: Sj.h: A tiny little JSON parsing library in ~150 lines of C99
#180Earlier quoted context omitted.
The license says otherwise; hard to get freer than public domain.
Open source is a more informative term for this than free software. Not all free software is open source, but all open source software is free. Edit: I was not aware of the FSF's definition. I was using a definition of free software being software that you can use without having to pay for it.
To add an additional suggestion, gratis can also be used to refer to free as in free beer. Comes from a latin root and is common in spanish speaking countries to refer only to free of charge, and not as in freedom.