Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-27580: Add support of null characters in csv #28808

Merged
merged 2 commits into from Oct 9, 2021

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Oct 7, 2021

@serhiy-storchaka serhiy-storchaka added the type-feature A feature request or enhancement label Oct 7, 2021
@serhiy-storchaka serhiy-storchaka changed the title bpo-27580: Add support of null characters in :mod:csv. bpo-27580: Add support of null characters in csv Oct 7, 2021
@serhiy-storchaka serhiy-storchaka requested review from encukou and removed request for encukou Oct 7, 2021
@serhiy-storchaka
Copy link
Member Author

serhiy-storchaka commented Oct 7, 2021

@smontanaro, please take a look. For unknown reasons I cannot add you to reviewers.

@smontanaro
Copy link
Contributor

smontanaro commented Oct 7, 2021

For unknown reasons I cannot add you to reviewers.

Maybe that's by design. :-)

LGTM. I assume Doc/library/csv.rst will be updated at some point to make it clear that ASCII NUL is now a valid.

@ammaraskar
Copy link
Member

ammaraskar commented Oct 7, 2021

You don't have to necessarily do it here, but just a note to myself that we should update the csv fuzzer:

/* Ignore non null-terminated strings since _csv can't handle
embedded nulls */
if (memchr(data, '\0', size) == NULL) {
return 0;
}

to generate inputs with nulls, such as in the json fuzzer here:

PyObject* input_bytes = PyBytes_FromStringAndSize(data, size);
if (input_bytes == NULL) {
return 0;
}

in this or a follow up PR.

Copy link
Member

@corona10 corona10 left a comment

lgtm

@serhiy-storchaka
Copy link
Member Author

serhiy-storchaka commented Oct 9, 2021

I assume Doc/library/csv.rst will be updated at some point to make it clear that ASCII NUL is now a valid.

I have not found a good place for this. It was not documented that ASCII NUL is special. Perhaps a NEWS entry will be enough.

@serhiy-storchaka
Copy link
Member Author

serhiy-storchaka commented Oct 9, 2021

@ammaraskar, I have no experience with fuzzers. Feel free to add a new test if it is useful.

@serhiy-storchaka serhiy-storchaka merged commit b454e8e into python:main Oct 9, 2021
12 checks passed
@serhiy-storchaka serhiy-storchaka deleted the csv-nul branch Oct 9, 2021
@merwok
Copy link
Member

merwok commented Nov 8, 2022

#97503 is requesting a backport to 3.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants