Repository navigation
ext/mbstring: assert that mb_wchar_to_uuencode() pointer write is in bounds - #23955
Conversation
|
This is fine, but you are only checking the pointer against a lower bound; should it also be checked against an upper bound? @youkidearitai may also want to have a look. |
youkidearitai
left a comment
There was a problem hiding this comment.
I understand that len_byte address is must bigger than buf->str address.
LGTM
I mean, the pointer is created from subtracting from within the current allocation, so that shouldn't be an issue, but added |
59e5548 to
aa861a2
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
…n bounds Add a hardening assertion that when `mb_wchar_to_uuencode()` needs to update the length of the previous line, the location being written to is still part of the same overall output string (i.e. at or after the start of the buffer's `str`'s value pointer, and before the end of the char array).
aa861a2 to
e0bf53d
Compare
|
Yeah I figured it out, buf->limit isn't synced by MB_CONVERT_BUF_ENSURE, only by MB_CONVERT_BUF_STORE |
|
Ah... so the write isn't really OOB, but the variable which we based the assertion on wasn't telling us the actually end of the allocated space? |
|
Yes, so I switched the assertion to the correct limit |
|
If CI passes, let's go ahead and merge. @DanielEScherzer are you a committer? |
Yes |
* PHP-8.6: ext/mbstring: assert that `mb_wchar_to_uuencode()` pointer write is in bounds (#23955)
Add a hardening assertion that when
mb_wchar_to_uuencode()needs to update the length of the previous line, the location being written to is still part of the same overall output string (i.e. at or after the start of the buffer'sstr's value pointer, and before the end of the char array).