Skip to content

handling malformed csv fields#3

Open
akshayakumar-t wants to merge 1 commit intomainfrom
panic_caused_in_parse_csv
Open

handling malformed csv fields#3
akshayakumar-t wants to merge 1 commit intomainfrom
panic_caused_in_parse_csv

Conversation

@akshayakumar-t
Copy link
Copy Markdown

@akshayakumar-t akshayakumar-t commented Mar 31, 2026

Fix CSV Panic in parse_csv VRL Function

Problem

The quick-csv library panics when parsing CSV data with a lone quote at the end of a line, causing Vector to crash when processing malformed CSV files.

Panic location: quick-csv-0.1.6/src/columns.rs:25:44

Root Cause

In quick-csv, when iterating columns via bytes_columns(), the code attempts to strip quotes from quoted fields:

if s.starts_with(&[b'\"']) { &s[1..s.len() - 1] } else { s }
Input Description
a," Field followed by lone quote
" Entire line is just a quote
," Empty field then lone quote

Changes
src/stdlib/parse_csv.rs: Added ends_with_lone_quote() function and validation check before CSV parsing
Tests Added
lone_quote_at_end - a,"
just_a_quote - "
empty_field_then_lone_quote - ,"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant