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

Fix segmentation fault when an exception is raised while converting a dict key to a string #526

Merged

Conversation

JustAnotherArchivist
Copy link
Collaborator

Fixes #522

@codecov-commenter
Copy link

codecov-commenter commented Apr 13, 2022

Codecov Report

Merging #526 (935fe0c) into main (62dec8d) will increase coverage by 0.71%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #526      +/-   ##
==========================================
+ Coverage   90.76%   91.48%   +0.71%     
==========================================
  Files           6        6              
  Lines        1798     1809      +11     
==========================================
+ Hits         1632     1655      +23     
+ Misses        166      154      -12     
Impacted Files Coverage Δ
python/objToJSON.c 89.39% <100.00%> (+2.04%) ⬆️
tests/test_ujson.py 99.60% <100.00%> (+<0.01%) ⬆️
lib/ultrajsonenc.c 86.01% <0.00%> (+1.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62dec8d...935fe0c. Read the comment docs.

@JustAnotherArchivist JustAnotherArchivist marked this pull request as draft April 13, 2022 14:43
@JustAnotherArchivist JustAnotherArchivist marked this pull request as ready for review April 13, 2022 15:12
@JustAnotherArchivist
Copy link
Collaborator Author

There are still conditions that can lead to a seg fault with this patch (e.g. __str__ returning a string with a surrogate), but it does solve the originally reported issue, and I'll address the rest in another PR.

@hugovk hugovk added the changelog: Fixed For any bug fixes label Apr 14, 2022
@hugovk hugovk merged commit 7799498 into ultrajson:main Apr 14, 2022
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: Fixed For any bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeyboardInterrupt inside dict key's __str__ method leads to segmentation fault
4 participants