Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by layer8 on Sunday September 21, 2025 @02:17PM
(#45325242)
The problem in the present case is that the caller is not made aware of the limitation, so can’t be expected to prevent passing unsupported input, and has no way to handle the overflow case after the fact.
[ Parent
| on HN ]
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by skydhash on Sunday September 21, 2025 @02:25PM
(#45325296)
Do you not review libraries you add to your project? A quick scan of the issues page if it's on a forge? Or just reading through the code if it's small enough (or select functions)?
Code is the ultimate specification. I don't trust the docs if the behavior is different from what it's saying (or more often fails to mention). And anything that deals with recursive structures (or looping without a clear counter and checks) is my one of the first candidate for checks.
> has no way to handle the overflow case after the fact.
Fork/Vendor the code and add your assertions.
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by layer8 on Sunday September 21, 2025 @02:27PM
(#45325314)
Obviously I just did review it, and my conclusion was to not use that code.
In the spirit of the article you linked, I’d rather write my own version.
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by jama211 on Sunday September 21, 2025 @03:28PM
(#45325863)
If it has limitations they should be documented though right? especially if they’re security concerns.
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by knowitnone2 on Sunday September 21, 2025 @09:57PM
(#45328390)
If you review libraries, why do you need to quick scan the issues? You would have already identified all the issues right? Right?