Nykakin / chompjs

Parsing JavaScript objects into Python data structures
MIT License
198 stars 11 forks source link

Segfault when passing empty string #61

Closed abebus closed 5 months ago

abebus commented 5 months ago
_chompjs.parse('')
Segmentation fault

Python 3.12.3 (main, Apr 27 2024, 19:00:21) [GCC 11.4.0] on linux Platform Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35

Nykakin commented 5 months ago

Fixed in #62 but generally speaking you should avoid using _chompjs module directly and rely on higher level functions from main chompjs module.

abebus commented 5 months ago

Thanks! But I prefer using orjson module, instead of builtin json, it would be nice to have an option to pass a custom loads function to parse_js_object I could open a pull request with my untested implementation

Nykakin commented 5 months ago

Sounds like a good idea to allow customized loader.

Opened my own PR: https://github.com/Nykakin/chompjs/pull/63 because I also needed to update the documentation for this. Feel free to test it.