Skip to content

ext/bcmath: Fix bc_str2num accepting strings with embedded null bytes#21492

Open
jorgsowa wants to merge 1 commit intophp:masterfrom
jorgsowa:fix/bcmath-str2num-embedded-null-bypass
Open

ext/bcmath: Fix bc_str2num accepting strings with embedded null bytes#21492
jorgsowa wants to merge 1 commit intophp:masterfrom
jorgsowa:fix/bcmath-str2num-embedded-null-bypass

Conversation

@jorgsowa
Copy link
Contributor

bc_str2num accepts an explicit end boundary pointer but validated input using null-terminator checks (*ptr != '\0'). This caused strings with embedded null bytes to be silently truncated rather than rejected.

"100\x005" was parsed as "100" while "100a5" correctly threw a ValueError.

@LamentXU123
Copy link
Contributor

Is this technically a bc break? Would RFC in this case be required or not.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants