Skip to content

Error when parsing specific CSV file: "terminate called after throwing an instance of 'std::error_code'" #264

@kiyoshi0205

Description

@kiyoshi0205

I encountered an issue when attempting to parse a specific CSV file using the csv-parser library.

When providing the file as input, the following error is thrown and the program crashes:

$ g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ sample.cpp
$ ./a.out >/dev/null
terminate called after throwing an instance of 'std::error_code'
Aborted (core dumped)

This issue has been observed on an Ubuntu 22.04 LTS system.

sample.cpp

#include "single_include/csv.hpp"

int main() {
    csv::CSVReader reader{"sample.csv", csv::CSVFormat{}.no_header()};
    for (csv::CSVRow &row : reader) {
        for (csv::CSVField &field : row)
            std::cout << field.get() << " ";
        std::cout << std::endl;
    }
}

sample.csv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions