Skip to content

Fixes cctz::parse() to reject input with embedded NULs#337

Merged
derekmauro merged 1 commit intogoogle:masterfrom
derekmauro:absl2014
Feb 12, 2026
Merged

Fixes cctz::parse() to reject input with embedded NULs#337
derekmauro merged 1 commit intogoogle:masterfrom
derekmauro:absl2014

Conversation

@derekmauro
Copy link
Member

Original report: abseil/abseil-cpp#2014

@derekmauro derekmauro merged commit 58b6d4b into google:master Feb 12, 2026
7 of 8 checks passed
@derekmauro derekmauro deleted the absl2014 branch February 12, 2026 17:23
copybara-service bot pushed a commit to abseil/abseil-cpp that referenced this pull request Feb 12, 2026
This change adds the test case from google/cctz#337

PiperOrigin-RevId: 869318402
Change-Id: Ic6136aa56bf41e85e0ad42b6410c7430729bcd13
devbww added a commit to devbww/cctz that referenced this pull request Feb 19, 2026
The previous commit (PR google#337) was couched in terms of `parse()`
rejecting input strings containing NULs.  Instead, we should
treat NULs like other characters by allowing them in both the
format and input strings.

Similarly, `format()` should allow NULs in its format string.

Also:
 - Simplify `FormatTM()` calls by handling an empty format
   string internally, rather than by guarding each invocation.
 - Utilize the `std::string` iterator-pair constructor and
   `append()`.
@devbww
Copy link
Contributor

devbww commented Feb 19, 2026

Thanks for taking care of this, @derekmauro.

However, it seems to me that, rather than rejecting inputs containing NULs, a better approach would be to treat NULs just like other characters---to be matched between the input and format strings as they occur. The parameters are std::strings after all.

To that end, I'll send a PR presently. Please take a look.

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.

3 participants

Comments