TkTech / pysimdjson

Python bindings for the simdjson project.
https://pysimdjson.tkte.ch
Other
643 stars 54 forks source link

Out of bounds access when using parser.parse on 0-length memory view in 4.0.0 #81

Closed chutz closed 3 years ago

chutz commented 3 years ago

This code will result in an out of bounds memory access exception:

import simdjson

simdjson.Parser().parse(memoryview(b""))

The output is

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    simdjson.Parser().parse(memoryview(b""))
  File "simdjson/csimdjson.pyx", line 484, in csimdjson.Parser.parse
IndexError: Out of bounds on buffer access (axis 0)

It should raise a ValueError complaining that no JSON was found rather than an index error, as an empty bytes does.

TkTech commented 3 years ago

Thanks! This will go out as 4.0.1 once the tests and release pass.