Skip to content

Conversation

lemire
Copy link
Member

@lemire lemire commented Jan 6, 2023

No description provided.

@lemire
Copy link
Member Author

lemire commented Jan 6, 2023

I'm going to merge this because I consider that these two changes ought to be uncontroversial. The prior code was clearly unsafe.

@lemire lemire merged commit 20460a9 into main Jan 6, 2023
// We cast to an unsigned 8-bit integer because
// *pointer is of type 'char' which may be signed or unsigned.
// A negative index access in 'character_sets::hex' is unsafe.
url.path += character_sets::hex[uint8_t(*pointer) * 4];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also used inside unicode.cpp. We should update it too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not seen other such problems.

@anonrig anonrig deleted the dlemire/fixing_unsafe_code branch January 6, 2023 21:15
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.

2 participants