duckdb / duckdb-rs

Ergonomic bindings to duckdb for Rust
MIT License
464 stars 94 forks source link

crash when reading wrong format excel #357

Open zeroxaa opened 1 month ago

zeroxaa commented 1 month ago

I use the following code in my server: db.execute(format!("CREATE TABLE

AS SELECT * FROM st_read('{}');", xlsx).as_str(), [])?; xlsx is the local path to excel file, if provided with a random file, rust throws something like:

fatal runtime error: Rust cannot catch foreign exceptions

so the whole server crashes. I believe it also happens on read_json

attached is a file that causes the error.

1030tttttt25e02eca-268a-4915-9ea7-ae8bec2c53eb.xlsx

zeroxaa commented 1 month ago

i am duckdb-rs in 'bundled' way.

zeroxaa commented 1 month ago

when using same file in duckdb cli, it outputs Invalid Input Error: Malformed JSON in file "/tmp/1030tttttt25e02eca-268a-4915-9ea7-ae8bec2c53eb", at byte 1 in record/value 2: unexpected character.